Exceptions
Custom exceptions to catch various HTTP codes returned by the OpenAQ API.
BadRequestError
Bases: ClientError
HTTP 400 - Client request error.
Attributes:
Name | Type | Description |
---|---|---|
status |
int
|
HTTP status code |
NotAuthorized
Bases: AuthError
HTTP 401- Not authorized.
Attributes:
Name | Type | Description |
---|---|---|
status |
int
|
HTTP status code |
Forbidden
Bases: AuthError
HTTP 403 - Forbidden.
Attributes:
Name | Type | Description |
---|---|---|
status |
int
|
HTTP status code |
NotFoundError
Bases: ClientError
HTTP 404 - Resource not found.
Attributes:
Name | Type | Description |
---|---|---|
status |
int
|
HTTP status code |
ValidationError
Bases: BadRequestError
HTTP 422 - Client request with invalid parameters.
Attributes:
Name | Type | Description |
---|---|---|
status |
int
|
HTTP status code |
RateLimit
Bases: ClientError
HTTP 429 - Client request exceeds rate limits.
Attributes:
Name | Type | Description |
---|---|---|
status |
int
|
HTTP status code |
ServerError
Bases: Exception
HTTP 500 - Server or service failure.
Attributes:
Name | Type | Description |
---|---|---|
status |
int
|
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 |
int
|
HTTP status code |