MCPcopy Create free account
hub / github.com/sammchardy/python-binance / BinanceAPIException

Class BinanceAPIException

binance/exceptions.py:5–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3
4
5class BinanceAPIException(Exception):
6 def __init__(self, response, status_code, text):
7 self.code = 0
8 try:
9 json_res = json.loads(text)
10 except ValueError:
11 self.message = "Invalid JSON error message from Binance: {}".format(
12 response.text
13 )
14 else:
15 self.code = json_res.get("code")
16 self.message = json_res.get("msg")
17 self.status_code = status_code
18 self.response = response
19 self.request = getattr(response, "request", None)
20
21 def __str__(self): # pragma: no cover
22 return "APIError(code=%s): %s" % (self.code, self.message)
23
24
25class BinanceRequestException(Exception):

Callers 3

_handle_responseMethod · 0.90
_handle_messageMethod · 0.90
_handle_responseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…