Show error response body on HTTP failures, v1.0.12

This commit is contained in:
2026-07-24 08:40:11 +04:00
parent 830c8100f2
commit 9a096f45d2
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -19,7 +19,8 @@ class HttpClient:
def post(self, path, data=None, **kwargs):
kwargs.setdefault("timeout", 30)
r = self._session.post(f"{self._endpoint}{path}", json=data, **kwargs)
r.raise_for_status()
if not r.ok:
raise Exception(f"{r.status_code} {r.reason}: {r.text[:200]}")
result = {}
try:
result = r.json()