From 947482872efcf6c7a559674e3e50f0d492673bad Mon Sep 17 00:00:00 2001 From: genjix Date: Wed, 21 Mar 2012 10:39:50 +0000 Subject: [PATCH] Fixed syntax error part for requestor --- stratum.py | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/stratum.py b/stratum.py index 74e5866..8a25065 100644 --- a/stratum.py +++ b/stratum.py @@ -148,15 +148,15 @@ class TcpClientRequestor(threading.Thread): continue try: - message_id = command.get('id') - method = command.get('method') - params = command.get('params') - except: + # Try to load vital fields, and return an error if + # unsuccessful. + message_id = command['id'] + method = command['method'] + except KeyError: + # This should return an error JSON in response. print "syntax error", repr(command), self.session.address[0] - continue - - self.session.push_request((message_id, method, params)) - print message_id, method, params + else: + self.session.push_request(command) class TcpServer(threading.Thread): -- 1.7.1