summaryrefslogtreecommitdiffstats
path: root/bitvend/processor.py
diff options
context:
space:
mode:
authorvoltar13 <voltar13@hackerspace.pl>2019-01-30 21:02:44 +0100
committerPiotr Dobrowolski <admin@tastycode.pl>2019-01-31 19:31:16 +0100
commit445913037077a7eeb66aeb6c06b731655b6b4c59 (patch)
treee2a63e24aed8be3aa3e8ad8f53bad3185840787c /bitvend/processor.py
parent9adff5141e462414589c954f45e19383e52bcbe5 (diff)
downloadbitvend-feature/cython.tar.gz
bitvend-feature/cython.tar.bz2
bitvend-feature/cython.tar.xz
bitvend-feature/cython.zip
Fix bitcoin payments by adding blockcypher tokenfeature/cython
Diffstat (limited to 'bitvend/processor.py')
-rw-r--r--bitvend/processor.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/bitvend/processor.py b/bitvend/processor.py
index 37732f0..2dc4ce0 100644
--- a/bitvend/processor.py
+++ b/bitvend/processor.py
@@ -15,12 +15,15 @@ class PaymentProcessor(threading.Thread):
last_pong = 0
app = None
- def __init__(self, device, input_address=None, chain_id=None, app=None):
+ def __init__(
+ self, device, input_address=None, chain_id=None, app=None,
+ token=None):
super(PaymentProcessor, self).__init__()
self.device = device
self.input_address = input_address
self.chain_id = chain_id
self.logger = logging.getLogger(type(self).__name__)
+ self.token = token
if app:
self.init_app(app)
@@ -31,6 +34,7 @@ class PaymentProcessor(threading.Thread):
if not self.input_address:
self.input_address = self.app.config['INPUT_ADDRESS']
self.chain_id = self.app.config['BLOCKCYPHER_CHAIN']
+ self.token = self.app.config['BLOCKCYPHER_TOKEN']
def run(self):
self.logger.info('Starting...')
@@ -38,12 +42,13 @@ class PaymentProcessor(threading.Thread):
while True:
try:
ws = websocket.WebSocketApp(
- "wss://socket.blockcypher.com/v1/%s" % self.chain_id,
+ "wss://socket.blockcypher.com/v1/%s?token=%s" \
+ % (self.chain_id, self.token),
on_message=self.on_message,
on_error=self.on_error,
- on_close=self.on_close)
+ on_close=self.on_close,
+ on_open=self.on_open)
- ws.on_open = self.on_open
ws.run_forever(ping_timeout=20, ping_interval=30)
except:
self.logger.exception('run_forever failed')