From 6c8982dd48fac4f4c94cceaaf05b0c90ec8357e0 Mon Sep 17 00:00:00 2001 From: Eric Somdahl Date: Tue, 28 Nov 2017 16:42:58 -0500 Subject: [PATCH] support python 2 --- bittrex_websocket/order_book.py | 8 ++++++-- bittrex_websocket/summary_state.py | 2 +- setup.py | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bittrex_websocket/order_book.py b/bittrex_websocket/order_book.py index 15b799b..fc5da56 100644 --- a/bittrex_websocket/order_book.py +++ b/bittrex_websocket/order_book.py @@ -4,7 +4,11 @@ # bittrex_websocket/order_book.py # Stanislav Lazarov -import queue +try: + import queue as queue +except ImportError: + import Queue as queue + from copy import deepcopy from threading import Thread from time import sleep, time @@ -86,7 +90,7 @@ def _retrieve(q, result): q.task_done() print('Retrieving order book snapshot...') - for j in range(num_threads): + for j in list(range(num_threads)): worker = Thread(target=_retrieve, args=(order_queue, order_books)) worker.setDaemon(True) worker.start() diff --git a/bittrex_websocket/summary_state.py b/bittrex_websocket/summary_state.py index 086e631..f7078e8 100644 --- a/bittrex_websocket/summary_state.py +++ b/bittrex_websocket/summary_state.py @@ -23,6 +23,6 @@ def on_message(self, *args, **kwargs): tickers = ['BTC-ETH', 'ETH-1ST', 'BTC-1ST', 'BTC-NEO', 'ETH-NEO'] ws = MyBittrexSocket(tickers) ws.run() - for i in range(10): + for i in list(range(10)): sleep(1) ws.stop() diff --git a/setup.py b/setup.py index 854fa61..3c83a9a 100644 --- a/setup.py +++ b/setup.py @@ -29,6 +29,9 @@ 'Intended Audience :: Information Technology', 'Topic :: Software Development :: Libraries :: Python Modules', 'License :: OSI Approved :: MIT License', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4',