Last active
December 10, 2015 16:22
-
-
Save neocogent/3f83c5bddecdf00d1a6a to your computer and use it in GitHub Desktop.
Using socketIO-client module to test the Bitpay Insight socket data.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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