mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
added support per py 3.9 and 3.10
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user