tno id in notifications - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit cb1a0f27def6232b5ff01b2ac9a1636dd19df03f DIR parent 50e3e28c23378d8151ddeb092cb9f8f0e975a4b9 HTML Author: ThomasV <thomasv@gitorious> Date: Tue, 27 Mar 2012 23:36:42 +0200 no id in notifications Diffstat: M client/blocks | 2 +- M client/interface.py | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) --- DIR diff --git a/client/blocks b/client/blocks t@@ -8,4 +8,4 @@ i.send([('numblocks.subscribe',[])]) while True: r = i.responses.get(True, 100000000000) - if r.get('method')=='numblocks.subscribe': print r.get('result') + print r.get('result') DIR diff --git a/client/interface.py b/client/interface.py t@@ -40,7 +40,6 @@ class Interface: #json self.message_id = 0 - self.messages = {} self.responses = Queue.Queue() t@@ -55,11 +54,13 @@ class Interface: result = c.get('result') error = c.get('error') - if msg_id is None: - print "error: message without ID" + try: + method = c['method'] + params = c['params'] + except: + print "error" return - method, params = self.messages[msg_id] if error: print "received error:", c, method, params else: t@@ -241,7 +242,6 @@ class HttpInterface(PollingInterface): method, params = m if type(params) != type([]): params = [params] data.append( { 'method':method, 'id':self.message_id, 'params':params } ) - self.messages[self.message_id] = (method, params) self.message_id += 1 if data: t@@ -311,7 +311,6 @@ class AsynchronousInterface(Interface): for m in messages: method, params = m request = json.dumps( { 'id':self.message_id, 'method':method, 'params':params } ) - self.messages[self.message_id] = (method, params) self.message_id += 1 out += request + '\n' self.s.send( out )