Skip to content

Commit

Permalink
- fix str(HTTPStatus) == "HTTPStatus.OK" instead of "200" on python3.…
Browse files Browse the repository at this point in the history
…10 and older

- ease debugging
  • Loading branch information
Prime541 committed Oct 30, 2024
1 parent 3f10250 commit 094c0c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion aiven/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Error(Exception):
"""Request error"""

def __init__(self, response: Response, status: int = 520) -> None:
Exception.__init__(self, response.text)
Exception.__init__(self, f"{response.text}, status({type(status)})={str(status)}")
self.response = response
self.status = status

Expand Down
4 changes: 2 additions & 2 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
class MockResponse:
def __init__(
self,
status_code: int,
status_code: int | HTTPStatus,
json_data: dict[str, Any] | None = None,
headers: dict[str, str] | None = None,
content: bytes | None = None,
):
self.status_code = status_code
self.status_code = status_code.value if isinstance(status_code, HTTPStatus) else status_code
self.json_data = json_data
if content is not None:
self.content = content
Expand Down

0 comments on commit 094c0c6

Please sign in to comment.