1
This commit is contained in:
1 parent
2ea1a79bda
commit
85425483c0
50 files changed
+6468
-1854
No files matched your search
@@ -167,8 +167,13 @@ def _http(method: str, url: str, headers: dict | None = None, body: bytes | None
|
||||
else:
|
||||
_give_back(parts.scheme, parts.netloc, conn)
|
||||
if resp.status >= 400:
|
||||
raise LiveError(f"HTTP {resp.status}: {data.decode('utf-8', 'replace')[:300]}")
|
||||
return json.loads(data or b"{}")
|
||||
raise LiveError(f"HTTP {resp.status}: {data.decode('utf-8', 'replace')[:300]}",
|
||||
sent=method in ("POST", "DELETE") and resp.status >= 500)
|
||||
try:
|
||||
return json.loads(data or b"{}")
|
||||
except (ValueError, UnicodeDecodeError) as exc:
|
||||
raise LiveError(f"не удалось прочитать ответ биржи: {exc}",
|
||||
sent=method in ("POST", "DELETE")) from None
|
||||
raise LiveError("нет связи")
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user