gfwapiclient.exceptions.client

Global Fishing Watch (GFW) API Python Client - Client Exceptions.

Module Contents

Data

API

gfwapiclient.exceptions.client.__all__ = ['AccessTokenError', 'BaseUrlError']
gfwapiclient.exceptions.client.BASE_URL_ERROR_MESSAGE: Final[str] = 'The `base_url` must be provided either as an argument or set via the `GFW_API_BASE_URL` environment ...'
gfwapiclient.exceptions.client.ACCESS_TOKEN_ERROR_MESSAGE: Final[str] = 'The `access_token` must be provided either as an argument or set via the `GFW_API_ACCESS_TOKEN` envi...'
exception gfwapiclient.exceptions.client.BaseUrlError

Bases: gfwapiclient.exceptions.base.GFWAPIClientError

Exception raised when no base_url is provided for the API client.

This error occurs if the base_url is not explicitly provided during HTTPClient initialization and is also missing from the environment variable GFW_API_BASE_URL.

Example:

```python from gfwapiclient.exceptions import BaseUrlError

try:

raise BaseUrlError()

except BaseUrlError as exc:

print(f”GFW Exception: {exc}”)

```

Initialization

Initialize a new BaseUrlError with a predefined error message.

exception gfwapiclient.exceptions.client.AccessTokenError

Bases: gfwapiclient.exceptions.base.GFWAPIClientError

Exception raised when no access_token is provided for the API client.

This error occurs if the access_token is not explicitly provided during HTTPClient initialization and is also missing from the environment variable GFW_API_ACCESS_TOKEN.

Example:

```python from gfwapiclient.exceptions import AccessTokenError

try:

raise AccessTokenError()

except AccessTokenError as exc:

print(f”GFW Exception: {exc}”)

```

Initialization

Initialize a new AccessTokenError with a predefined error message.