Fixed socket.send() issue (IndexError: deque index out of range)

This commit is contained in:
itsdeka
2021-12-20 12:17:27 +01:00
parent e7262d88ba
commit 7f47405fa3
5 changed files with 21 additions and 2 deletions

View File

@@ -1,3 +1,6 @@
1.3.3
-) Fixed socket.send() issue (IndexError: deque index out of range)
1.3.2 1.3.2
-) Implemented Merchants endpoints (REST) -) Implemented Merchants endpoints (REST)

View File

@@ -0,0 +1,12 @@
from ..utils.custom_logger import CustomLogger
def handle_failure(func):
def inner_function(*args, **kwargs):
logger = CustomLogger('BfxWebsocket', logLevel="DEBUG")
try:
func(*args, **kwargs)
except Exception as exception_message:
logger.error(exception_message)
return inner_function

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.3.2' __version__ = '1.3.3'

View File

@@ -12,6 +12,7 @@ from .subscription_manager import SubscriptionManager
from .wallet_manager import WalletManager from .wallet_manager import WalletManager
from .order_manager import OrderManager from .order_manager import OrderManager
from ..utils.auth import generate_auth_payload from ..utils.auth import generate_auth_payload
from ..utils.decorators import handle_failure
from ..models import Order, Trade, OrderBook, Ticker, FundingTicker from ..models import Order, Trade, OrderBook, Ticker, FundingTicker
@@ -481,6 +482,7 @@ class BfxWebsocket(GenericWebsocket):
else: else:
self.logger.warn('Unknown (socketId={}) websocket response: {}'.format(socketId, msg)) self.logger.warn('Unknown (socketId={}) websocket response: {}'.format(socketId, msg))
@handle_failure
async def _ws_authenticate_socket(self, socketId): async def _ws_authenticate_socket(self, socketId):
socket = self.sockets[socketId] socket = self.sockets[socketId]
socket.set_authenticated() socket.set_authenticated()
@@ -507,6 +509,7 @@ class BfxWebsocket(GenericWebsocket):
# re-subscribe to existing channels # re-subscribe to existing channels
await self.subscriptionManager.resubscribe_by_socket(socket_id) await self.subscriptionManager.resubscribe_by_socket(socket_id)
@handle_failure
async def _send_auth_command(self, channel_name, data): async def _send_auth_command(self, channel_name, data):
payload = [0, channel_name, None, data] payload = [0, channel_name, None, data]
socket = self.get_authenticated_socket() socket = self.get_authenticated_socket()
@@ -538,6 +541,7 @@ class BfxWebsocket(GenericWebsocket):
total += self.get_socket_capacity(socketId) total += self.get_socket_capacity(socketId)
return total return total
@handle_failure
async def enable_flag(self, flag): async def enable_flag(self, flag):
""" """
Enable flag on websocket connection Enable flag on websocket connection

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.3.2', version='1.3.3',
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',