2012-03-17 12:51:16 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
2012-10-11 20:10:12 +02:00
|
|
|
from electrum import Interface
|
2012-03-17 12:51:16 +01:00
|
|
|
|
2012-10-11 20:10:12 +02:00
|
|
|
i = Interface({'server':'electrum.novit.ro:50001:t'})
|
2012-05-17 20:26:37 +02:00
|
|
|
i.init_socket()
|
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:
|
|
|
|
|
r = i.responses.get(True, 100000000000)
|
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
|
break
|
2012-05-17 20:26:37 +02:00
|
|
|
if r.get('method') == 'blockchain.numblocks.subscribe':
|
|
|
|
|
print r.get('result')
|