Merge pull request #180 from itsdeka/marketorders

added support for py 3.9 and 3.10
This commit is contained in:
Vigan Abdurrahmani
2021-11-30 19:42:36 +01:00
committed by GitHub
7 changed files with 17 additions and 11 deletions

View File

@@ -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

View File

@@ -1,6 +1,5 @@
import pytest
import json
import asyncio
from .helpers import (create_stubbed_client, ws_publish_connection_init, EventWatcher)
@pytest.mark.asyncio

View File

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

View File

@@ -266,7 +266,7 @@ class BfxWebsocket(GenericWebsocket):
socketId,
ERRORS[data.get('code', 10000)],
data.get("msg", ""))
self._emit('error', err_string)
self._emit(Exception(err_string))
async def _system_auth_handler(self, socketId, data):
if data.get('status') == 'FAILED':

View File

@@ -44,7 +44,7 @@ class Socket():
def set_authenticated(self):
self.isAuthenticated = True
def set_unauthenticated(self):
self.isAuthenticated = False
@@ -84,6 +84,8 @@ class GenericWebsocket:
thread and connection.
"""
self._start_new_socket()
while True:
time.sleep(1)
def get_task_executable(self):
"""
@@ -91,14 +93,14 @@ class GenericWebsocket:
"""
return self._run_socket()
def _start_new_async_socket(self):
loop = asyncio.new_event_loop()
loop.run_until_complete(self._run_socket())
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 = Thread(target=self._start_new_async_socket)
worker.start()
return socketId
@@ -190,6 +192,8 @@ class GenericWebsocket:
self.events.once(event, func)
def _emit(self, event, *args, **kwargs):
if type(event) == Exception:
self.logger.error(event)
self.events.emit(event, *args, **kwargs)
async def on_error(self, error):

View File

@@ -5,4 +5,4 @@ pytest-asyncio==0.15.1
six==1.12.0
pyee==8.0.1
aiohttp==3.4.4
isort==4.3.21
isort==4.3.21

View File

@@ -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',