added support per py 3.9 and 3.10

This commit is contained in:
itsdeka
2021-11-24 14:34:33 +01:00
parent f78926b2f8
commit abfafbf8cf
5 changed files with 9 additions and 8 deletions

View File

@@ -1,3 +1,6 @@
1.2.7
-) Added ws support for Python 3.9 and 3.10
1.2.6 1.2.6
-) Updated websockets to 9.1 -) Updated websockets to 9.1

View File

@@ -2,4 +2,4 @@
This module contains the current version of the bfxapi lib This module contains the current version of the bfxapi lib
""" """
__version__ = '1.2.6' __version__ = '1.2.7'

View File

@@ -7,6 +7,7 @@ import websockets
import socket import socket
import json import json
import time import time
import nest_asyncio
from threading import Thread, Lock from threading import Thread, Lock
from pyee import AsyncIOEventEmitter from pyee import AsyncIOEventEmitter
@@ -14,6 +15,7 @@ from ..utils.custom_logger import CustomLogger
# websocket exceptions # websocket exceptions
from websockets.exceptions import ConnectionClosed, InvalidStatusCode from websockets.exceptions import ConnectionClosed, InvalidStatusCode
nest_asyncio.apply()
class AuthError(Exception): class AuthError(Exception):
""" """
@@ -94,12 +96,7 @@ class GenericWebsocket:
def _start_new_socket(self, socketId=None): def _start_new_socket(self, socketId=None):
if not socketId: if not socketId:
socketId = len(self.sockets) socketId = len(self.sockets)
def start_loop(loop): asyncio.run(self._run_socket())
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()
return socketId return socketId
def _wait_for_socket(self, socket_id): def _wait_for_socket(self, socket_id):

View File

@@ -6,3 +6,4 @@ six==1.12.0
pyee==8.0.1 pyee==8.0.1
aiohttp==3.4.4 aiohttp==3.4.4
isort==4.3.21 isort==4.3.21
nest_asyncio==1.5.1

View File

@@ -11,7 +11,7 @@ from os import path
here = path.abspath(path.dirname(__file__)) here = path.abspath(path.dirname(__file__))
setup( setup(
name='bitfinex-api-py', name='bitfinex-api-py',
version='1.2.6', version='1.2.7',
description='Official Bitfinex Python API', description='Official Bitfinex Python API',
long_description='A Python reference implementation of the Bitfinex API for both REST and websocket interaction', long_description='A Python reference implementation of the Bitfinex API for both REST and websocket interaction',
long_description_content_type='text/markdown', long_description_content_type='text/markdown',