abstract_api.core.exceptions.api_request_error module#

exception abstract_api.core.exceptions.api_request_error.APIRequestError(http_status: int, body: bytes, raised_error_message: str, message: str | None = None, code: str | None = None, details: dict[str, Any] | None = None)[source]#

Bases: AbstractAPIException

Raised when there’s a problem with returned in API response.

property body: bytes#

Response body.

property code: str | None#

Error code returned from API.

property details: dict[str, Any] | None#

Error details returned from API.

property http_status: int#

HTTP status code.

property message: str | None#

Error message returned from API.

classmethod raise_from_response(response: Response) NoReturn[source]#

Raises an exception from given response.

Args:

response: HTTP response object returned from API call.

Raises:
APIRequestError: An exception with returned HTTP status code and

error details returned from API when available.