Skip to content

Commit 83796f0

Browse files
🐛 fix invalid error code handling for some errors (#228)
1 parent cf90f04 commit 83796f0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mindee/mindee_http/response_validation.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ def clean_request_json(response: requests.Response) -> StringDict:
6363
return response_json
6464
corrected_json = response_json
6565
if (
66-
"status_code" in response_json["api_request"]
67-
and response_json["api_request"]["status_code"].isdigit()
66+
"api_request" in response_json
67+
and "status_code" in response_json["api_request"]
68+
and isinstance(response_json["api_request"]["status_code"], (int, str))
69+
and str(response_json["api_request"]["status_code"]).isdigit()
6870
and int(response_json["api_request"]["status_code"]) >= 400
6971
):
7072
corrected_json["status_code"] = int(response_json["api_request"]["status_code"])

0 commit comments

Comments
 (0)