Configuration & exceptions#
Configuration settings for SGU API client. |
|
Base exception for all SGU client errors. |
|
Raised when the SGU API returns an error response. |
|
Raised when connection to SGU API fails. |
|
Raised when a request to SGU API times out. |
|
Raised when data validation fails. |
|
Raised when a lookup matches no feature. |
|
Raised when a lookup that expects one feature matches several. |
Configuration#
Pass an SGUConfig to SGUClient to change timeouts, retries or logging.
The configuration is immutable once created.
timeout, max_retries and user_agent configure the default
RequestsTransport. A transport you pass to SGUClient(transport=...) doesn’t
use them (see Client).
Exceptions#
All exceptions raised by the client inherit from SGUClientError, so catching it
handles every client error:
SGUClientError
├── SGUAPIError the API returned an error response
├── SGUConnectionError the connection to the API failed
├── SGUTimeoutError the request timed out
├── SGUValidationError data validation failed
├── SGUNotFoundError a lookup matched nothing (also a ValueError)
└── SGUAmbiguousError a lookup expecting one feature matched several
(also a ValueError)
- exception SGUAPIError(message, status_code=None, response_data=None)[source]#
Raised when the SGU API returns an error response.