mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
[PR #11573/f9e583da backport][stable-12] fix: remove HTTPStatus constructs introduced in Python 3.11 (#11575)
fix: remove HTTPStatus constructs introduced in Python 3.11 (#11573)
* fix: remove HTTPStatus constructs introduced in Python 3.11
* add changelog frag
(cherry picked from commit f9e583dae2)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
@@ -42,8 +42,7 @@ class RequestError(Exception):
|
||||
|
||||
|
||||
def handle_consul_response_error(response):
|
||||
status = HTTPStatus(response.status_code)
|
||||
if status.is_client_error or status.is_server_error:
|
||||
if response.status_code >= HTTPStatus.BAD_REQUEST: # 4xx and 5xx errors
|
||||
raise RequestError(f"{response.status_code} {response.content}")
|
||||
|
||||
|
||||
@@ -323,8 +322,7 @@ class _ConsulModule:
|
||||
)
|
||||
raise
|
||||
|
||||
_status = HTTPStatus(status)
|
||||
if _status.is_client_error or _status.is_server_error:
|
||||
if status >= HTTPStatus.BAD_REQUEST: # 4xx and 5xx errors
|
||||
raise RequestError(status, response_data)
|
||||
|
||||
if response_data:
|
||||
|
||||
Reference in New Issue
Block a user