Exceptions
Custom exceptions to catch various HTTP codes returned by the OpenAQ API.
ApiKeyMissingError
Bases: AuthError
API Key missing error.
AuthError
Bases: ClientError
Authentication error, improperly supplied credentials.
BadRequestError
Bases: ClientError
HTTP 400 - Client request error.
Attributes:
Name | Type | Description |
---|---|---|
status_code |
int
|
HTTP status code |
BadGatewayError
Bases: ServerError
HTTP 502 - Indicates that the gateway or proxy received an invalid response from the upstream server.
Attributes:
Name | Type | Description |
---|---|---|
status_code |
Literal[502]
|
HTTP status code |
ForbiddenError
Bases: AuthError
HTTP 403 - Forbidden.
Attributes:
Name | Type | Description |
---|---|---|
status_code |
Literal[403]
|
HTTP status code |
GatewayTimeoutError
Bases: ServerError
HTTP 504 - Timeout from the gateway after failing to route request to destination service.
Attributes:
Name | Type | Description |
---|---|---|
status_code |
Literal[504]
|
HTTP status code |
HTTPRateLimitError
Bases: ClientError
HTTP 429 - Client request exceeds rate limits.
Attributes:
Name | Type | Description |
---|---|---|
status_code |
Literal[429]
|
HTTP status code |
NotAuthorizedError
Bases: AuthError
HTTP 401- Not authorized.
Attributes:
Name | Type | Description |
---|---|---|
status_code |
Literal[401]
|
HTTP status code |
NotFoundError
Bases: ClientError
HTTP 404 - Resource not found.
Attributes:
Name | Type | Description |
---|---|---|
status_code |
Literal[404]
|
HTTP status code |
RateLimitError
Bases: ClientError
Exception for catching rate limit exceedances from client.
ServerError
Bases: Exception
HTTP 500 - Server or service failure.
Attributes:
Name | Type | Description |
---|---|---|
status_code |
int
|
HTTP status code |
ServiceUnavailableError
Bases: ServerError
HTTP 503 - Indicates that the server is not ready to handle the request.
Attributes:
Name | Type | Description |
---|---|---|
status_code |
Literal[503]
|
HTTP status code |
ValidationError
Bases: BadRequestError
HTTP 422 - Client request with invalid parameters.
Attributes:
Name | Type | Description |
---|---|---|
status_code |
Literal[422]
|
HTTP status code |