Skip to content

Instantly share code, notes, and snippets.

@neocogent
Last active December 10, 2015 16:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neocogent/3f83c5bddecdf00d1a6a to your computer and use it in GitHub Desktop.
Save neocogent/3f83c5bddecdf00d1a6a to your computer and use it in GitHub Desktop.
Using socketIO-client module to test the Bitpay Insight socket data.
#!/usr/bin/env python
#
# socketio client
#
import sys, logging
logging.captureWarnings(True)
#logging.basicConfig(level=logging.DEBUG)
from socketIO_client import SocketIO, BaseNamespace
class Namespace(BaseNamespace):
def on_connect(self):
print 'Connected'
socketIO.emit('subscribe', 'inv')
def on_tx(self, msg):
print 'tx', msg['txid'], msg['valueOut']
def on_block(self, *args):
print 'blk', args
try:
socketIO = SocketIO('https://insight.bitpay.com',443, Namespace, verify=False)
socketIO.wait()
except KeyboardInterrupt:
sys.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment