From abfafbf8cf0cb304feba4c81a9cb303eba18bef8 Mon Sep 17 00:00:00 2001 From: itsdeka Date: Wed, 24 Nov 2021 14:34:33 +0100 Subject: [PATCH] added support per py 3.9 and 3.10 --- CHANGELOG | 3 +++ bfxapi/version.py | 2 +- bfxapi/websockets/generic_websocket.py | 9 +++------ requirements.txt | 1 + setup.py | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index dcd341b..b7426db 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +1.2.7 +-) Added ws support for Python 3.9 and 3.10 + 1.2.6 -) Updated websockets to 9.1 diff --git a/bfxapi/version.py b/bfxapi/version.py index a663868..64e75f8 100644 --- a/bfxapi/version.py +++ b/bfxapi/version.py @@ -2,4 +2,4 @@ This module contains the current version of the bfxapi lib """ -__version__ = '1.2.6' +__version__ = '1.2.7' diff --git a/bfxapi/websockets/generic_websocket.py b/bfxapi/websockets/generic_websocket.py index a92ebd9..4f7d482 100644 --- a/bfxapi/websockets/generic_websocket.py +++ b/bfxapi/websockets/generic_websocket.py @@ -7,6 +7,7 @@ import websockets import socket import json import time +import nest_asyncio from threading import Thread, Lock from pyee import AsyncIOEventEmitter @@ -14,6 +15,7 @@ from ..utils.custom_logger import CustomLogger # websocket exceptions from websockets.exceptions import ConnectionClosed, InvalidStatusCode +nest_asyncio.apply() class AuthError(Exception): """ @@ -94,12 +96,7 @@ class GenericWebsocket: def _start_new_socket(self, socketId=None): if not socketId: socketId = len(self.sockets) - def start_loop(loop): - asyncio.set_event_loop(loop) - loop.run_until_complete(self._run_socket()) - worker_loop = asyncio.new_event_loop() - worker = Thread(target=start_loop, args=(worker_loop,)) - worker.start() + asyncio.run(self._run_socket()) return socketId def _wait_for_socket(self, socket_id): diff --git a/requirements.txt b/requirements.txt index b579314..9f4cfff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ six==1.12.0 pyee==8.0.1 aiohttp==3.4.4 isort==4.3.21 +nest_asyncio==1.5.1 \ No newline at end of file diff --git a/setup.py b/setup.py index 69f5e2e..cec0c1f 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ from os import path here = path.abspath(path.dirname(__file__)) setup( name='bitfinex-api-py', - version='1.2.6', + version='1.2.7', description='Official Bitfinex Python API', long_description='A Python reference implementation of the Bitfinex API for both REST and websocket interaction', long_description_content_type='text/markdown',