commit cb1a0f27def6232b5ff01b2ac9a1636dd19df03f
parent 50e3e28c23378d8151ddeb092cb9f8f0e975a4b9
Author: ThomasV <thomasv@gitorious>
Date: Tue, 27 Mar 2012 23:36:42 +0200
no id in notifications
Diffstat:
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/client/blocks b/client/blocks
@@ -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')
diff --git a/client/interface.py b/client/interface.py
@@ -40,7 +40,6 @@ class Interface:
#json
self.message_id = 0
- self.messages = {}
self.responses = Queue.Queue()
@@ -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:
@@ -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:
@@ -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 )