Add example to submit, cancel, edit order and adjust issue in labeler.py

This commit is contained in:
itsdeka
2023-01-06 18:22:39 +01:00
committed by Davide Casale
parent ef836bbe1a
commit 22f6fe01fd
4 changed files with 48 additions and 8 deletions

View File

@@ -9,11 +9,9 @@ from typing import List, Union, Literal, Optional, Any, cast
from . import serializers
from .typings import *
from .enums import Config, Precision, Sort, OrderType, FundingOfferType, Error
from .enums import Config, Sort, OrderType, FundingOfferType, Error
from .exceptions import ResourceNotFound, RequestParametersError, InvalidAuthenticationCredentials, UnknownGenericError
from .. utils.integers import Int16, int32, int45, int64
from .. utils.encoder import JSONEncoder
class BfxRestInterface(object):
@@ -64,7 +62,9 @@ class _Requests(object):
if _append_authentication_headers:
headers = { **headers, **self.__build_authentication_headers(endpoint, data) }
response = requests.post(f"{self.host}/{endpoint}", params=params, data=json.dumps(data, cls=JSONEncoder), headers=headers)
data = (data and json.dumps({ key: value for key, value in data.items() if value != None}, cls=JSONEncoder) or None)
response = requests.post(f"{self.host}/{endpoint}", params=params, data=data, headers=headers)
if response.status_code == HTTPStatus.NOT_FOUND:
raise ResourceNotFound(f"No resources found at endpoint <{endpoint}>.")