levo-commons 0.2.1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {levo_commons-0.2.1 → levo_commons-0.2.2}/PKG-INFO +1 -1
- {levo_commons-0.2.1 → levo_commons-0.2.2}/setup.py +1 -1
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons/request_utils.py +3 -3
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons.egg-info/PKG-INFO +1 -1
- {levo_commons-0.2.1 → levo_commons-0.2.2}/README.md +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/pyproject.toml +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/setup.cfg +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons/__init__.py +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons/config.py +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons/cwe.py +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons/events.py +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons/failures.py +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons/models.py +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons/params.py +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons/providers.py +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons/status.py +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons/types.py +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons/utils.py +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons.egg-info/SOURCES.txt +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons.egg-info/dependency_links.txt +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons.egg-info/requires.txt +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/src/levo_commons.egg-info/top_level.txt +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/test/test_config.py +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/test/test_request_utils.py +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/test/test_sanity.py +0 -0
- {levo_commons-0.2.1 → levo_commons-0.2.2}/test/test_utils.py +0 -0
|
@@ -36,7 +36,7 @@ STRING_CODE_TO_STATUS_DICT = {
|
|
|
36
36
|
|
|
37
37
|
# pylint: disable=too-many-branches
|
|
38
38
|
def get_error_code_from_response_body(
|
|
39
|
-
response: Union[str, Response, requests.Response]
|
|
39
|
+
response: Union[str, bytes, Response, requests.Response]
|
|
40
40
|
) -> Optional[int]:
|
|
41
41
|
"""Check if the response body contains an error code and return it.
|
|
42
42
|
|
|
@@ -44,7 +44,7 @@ def get_error_code_from_response_body(
|
|
|
44
44
|
"""
|
|
45
45
|
body_str = (
|
|
46
46
|
response
|
|
47
|
-
if isinstance(response, str)
|
|
47
|
+
if isinstance(response, (str, bytes))
|
|
48
48
|
else response.content
|
|
49
49
|
if isinstance(response, requests.Response)
|
|
50
50
|
else response.body
|
|
@@ -56,7 +56,7 @@ def get_error_code_from_response_body(
|
|
|
56
56
|
try:
|
|
57
57
|
decoded_body = base64.b64decode(body_str)
|
|
58
58
|
encoding = "utf8"
|
|
59
|
-
if not isinstance(response, str) and response.encoding:
|
|
59
|
+
if not isinstance(response, (str, bytes)) and response.encoding:
|
|
60
60
|
encoding = response.encoding
|
|
61
61
|
response_body = decoded_body.decode(encoding, errors="replace")
|
|
62
62
|
body = json.loads(response_body)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|