2012-03-17 12:51:16 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
2012-10-28 08:14:00 +01:00
|
|
|
import sys, electrum
|
2012-10-12 16:09:20 +02:00
|
|
|
|
2012-10-12 16:31:05 +02:00
|
|
|
i = electrum.Interface()
|
2012-10-28 08:14:00 +01:00
|
|
|
i.register_callback('connected', lambda: sys.stderr.write("Connected to %s\n" % i.connection_msg))
|
2012-03-25 08:53:23 +02:00
|
|
|
i.start()
|
2012-03-28 23:02:33 +02:00
|
|
|
i.send([('blockchain.numblocks.subscribe',[])])
|
2012-03-17 12:51:16 +01:00
|
|
|
|
|
|
|
|
while True:
|
2012-06-15 08:29:52 +02:00
|
|
|
try:
|
2012-10-21 02:57:31 +02:00
|
|
|
r = i.get_response()
|
2012-06-15 08:29:52 +02:00
|
|
|
except KeyboardInterrupt:
|
|
|
|
|
break
|
2012-05-17 20:26:37 +02:00
|
|
|
if r.get('method') == 'blockchain.numblocks.subscribe':
|
|
|
|
|
print r.get('result')
|