Exceptions
Exception classes for handling API errors.
- exception valopy.exceptions.ValoPyError[source]
Bases:
ExceptionBase exception for all ValoPy errors.
- exception valopy.exceptions.ValoPyHTTPError(message, status_code, url=None)[source]
Bases:
ValoPyErrorHTTP error with status code and URL information.
- exception valopy.exceptions.ValoPyNotFoundError(status_code, url=None)[source]
Bases:
ValoPyHTTPErrorResource not found (404).
- exception valopy.exceptions.ValoPyPermissionError(status_code, url=None, request_headers={}, redacted=False)[source]
Bases:
ValoPyHTTPErrorPermission denied (401).
- exception valopy.exceptions.ValoPyRateLimitError(status_code, url=None, response_headers={})[source]
Bases:
ValoPyHTTPErrorRate limit exceeded (429).
- exception valopy.exceptions.ValoPyRequestError(status_code, url=None)[source]
Bases:
ValoPyHTTPErrorBad request (400).
- exception valopy.exceptions.ValoPyServerError(status_code, url=None)[source]
Bases:
ValoPyHTTPErrorServer error (5xx).
- exception valopy.exceptions.ValoPyTimeoutError(status_code, url=None)[source]
Bases:
ValoPyHTTPErrorRequest timeout (408).
- exception valopy.exceptions.ValoPyValidationError(message)[source]
Bases:
ValoPyErrorValidation error for invalid parameter combinations.
- valopy.exceptions.from_client_response_error(error, redacted)[source]
Convert an aiohttp ClientResponseError to a ValoPyHTTPError.
- Parameters:
error (
aiohttp.ClientResponseError) – The original ClientResponseError.redacted (
bool) – Whether the API key in the request headers is redacted.
- Returns:
The corresponding ValoPy error matching the HTTP status code.
- Return type:
ValoPyHTTPError|ValoPyRequestError|ValoPyPermissionError|ValoPyNotFoundError|ValoPyTimeoutError|ValoPyRateLimitError|ValoPyServerError- Raises:
ValoPyRequestError – If status code is 400.
ValoPyPermissionError – If status code is 401.
ValoPyNotFoundError – If status code is 404.
ValoPyTimeoutError – If status code is 408.
ValoPyRateLimitError – If status code is 429.
ValoPyServerError – If status code is 5xx.
ValoPyHTTPError – For any other HTTP error status codes.