|
1 | 1 | import os |
2 | 2 | from typing import Any |
3 | 3 |
|
4 | | -from httpx import AsyncClient, HTTPError, HTTPStatusError, RequestError |
| 4 | +from httpx import AsyncClient, HTTPError, RequestError |
5 | 5 | from httpx_retries import Retry, RetryTransport |
6 | 6 |
|
7 | 7 | from mpt_api_client.constants import APPLICATION_JSON |
8 | | -from mpt_api_client.exceptions import MPTError, MPTMaxRetryError, transform_http_status_exception |
| 8 | +from mpt_api_client.exceptions import MPTError, MPTMaxRetryError |
9 | 9 | from mpt_api_client.http.client import json_to_file_payload |
10 | 10 | from mpt_api_client.http.client_utils import get_query_params, validate_base_url |
11 | 11 | from mpt_api_client.http.query_options import QueryOptions |
| 12 | +from mpt_api_client.http.request_response_utils import handle_response_http_error |
12 | 13 | from mpt_api_client.http.types import HeaderTypes, QueryParam, RequestFiles, Response |
13 | 14 |
|
14 | 15 |
|
@@ -102,10 +103,8 @@ async def request( # noqa: WPS211 |
102 | 103 | except HTTPError as err: |
103 | 104 | raise MPTError(f"HTTP Error: {err}") from err |
104 | 105 |
|
105 | | - try: |
106 | | - response.raise_for_status() |
107 | | - except HTTPStatusError as http_status_exception: |
108 | | - raise transform_http_status_exception(http_status_exception) from http_status_exception |
| 106 | + handle_response_http_error(response) |
| 107 | + |
109 | 108 | return Response( |
110 | 109 | headers=dict(response.headers), |
111 | 110 | status_code=response.status_code, |
|
0 commit comments