Fix and rewrite module bfx_websocket_inputs in bfxapi.websocket._client.

This commit is contained in:
Davide Casale
2023-10-25 05:52:55 +02:00
parent ddce83be0c
commit ac50f8f884
2 changed files with 34 additions and 28 deletions

View File

@@ -10,6 +10,8 @@ from typing_extensions import \
from abc import \
ABC, abstractmethod
from functools import wraps
from datetime import datetime
import hmac, hashlib, json
@@ -60,6 +62,7 @@ class Connection(ABC):
def _require_websocket_connection(
function: Callable[Concatenate[_S, _P], Awaitable[_R]]
) -> Callable[Concatenate[_S, _P], Awaitable[_R]]:
@wraps(function)
async def wrapper(self: _S, *args: Any, **kwargs: Any) -> _R:
if self.open:
return await function(self, *args, **kwargs)
@@ -72,6 +75,7 @@ class Connection(ABC):
def _require_websocket_authentication(
function: Callable[Concatenate[_S, _P], Awaitable[_R]]
) -> Callable[Concatenate[_S, _P], Awaitable[_R]]:
@wraps(function)
async def wrapper(self: _S, *args: Any, **kwargs: Any) -> _R:
if not self.authentication:
raise ActionRequiresAuthentication("To perform this action you need to " \