gfwapiclient.client.client
¶
Global Fishing Watch (GFW) API Python Client - Client.
Module Contents¶
Classes¶
Global Fishing Watch (GFW) API Client. |
Data¶
API¶
- gfwapiclient.client.client.__all__ = ['Client']¶
- gfwapiclient.client.client.GFW_API_BASE_URL: Final[str] = 'https://gateway.api.globalfishingwatch.org/v3/'¶
- class gfwapiclient.client.client.Client(*, access_token: Optional[str] = None, base_url: Optional[str] = None, follow_redirects: Optional[bool] = True, timeout: Optional[float] = 60.0, connect_timeout: Optional[float] = 5.0, max_connections: Optional[int] = 100, max_keepalive_connections: Optional[int] = 20, max_redirects: Optional[int] = 2, **kwargs: Any)¶
Global Fishing Watch (GFW) API Client.
This class serves as the main entry point for interacting with the GFW API. It encapsulates the HTTP client and resources, providing a unified interface for accessing GFW’s data.
For more details on the GFW API and available data, please refer to the official documentation:
See: https://globalfishingwatch.org/our-apis/documentation#introduction
See: https://globalfishingwatch.org/our-apis/documentation#data-available
- Attributes:
- fourwings (FourWingsResource):
Access to the 4Wings data API resources.
- vessels (VesselResource):
Access to the Vessels data API resources.
- events (EventResource):
Access to the Events data API resources.
- insights (InsightResource):
Access to the vessel insights data resources.
- references (ReferenceResource):
Access to the reference data resources.
Initialization
Initializes a new Global Fishing Watch (GFW) API Client with specified configurations.
- Args:
- base_url (Optional[Union[str, httpx.URL]], default=”https://gateway.api.globalfishingwatch.org/v3/”):
The base URL for API requests. If not provided, the value is taken from the GFW_API_BASE_URL environment variable. Default to “https://gateway.api.globalfishingwatch.org/v3/”.
- access_token (Optional[str], default=None):
The access token for API request authentication. If not provided, the value is taken from the GFW_API_ACCESS_TOKEN environment variable. Raises AccessTokenError if neither is set.
- follow_redirects (Optional[bool], default=True):
Whether the client should automatically follow redirects. Defaults to True.
- timeout (Optional[float], default=60.0):
The default timeout (in seconds) for all operations (connect, read, pool, etc.). Defaults to 60.0 seconds.
- connect_timeout (Optional[float], default=5.0):
Timeout (in seconds) for establishing a connection. Defaults to 5.0 seconds.
- max_connections (Optional[int], default=100):
Maximum number of concurrent connections. Defaults to 100.
- max_keepalive_connections (Optional[int], default=20):
Maximum number of keep-alive connections in the connection pool. Should not exceed max_connections. Defaults to 20.
- max_redirects (Optional[int], default=2):
Maximum number of redirects to follow before raising an error. Defaults to 2.
- **kwargs (Any):
Additional parameters passed to httpx.AsyncClient.
- Raises:
- AccessTokenError:
If access_token is not provided and the GFW_API_ACCESS_TOKEN environment variable is also not set.
- _fourwings: gfwapiclient.resources.FourWingsResource = None¶
- _vessels: gfwapiclient.resources.VesselResource = None¶
- _events: gfwapiclient.resources.EventResource = None¶
- _insights: gfwapiclient.resources.InsightResource = None¶
- _references: gfwapiclient.resources.ReferenceResource = None¶
- property fourwings: gfwapiclient.resources.FourWingsResource¶
4Wings data API resource.
Provides access to the 4Wings API resources, which allow users to retrieve reports on fishing activity and SAR vessel detections.
For more details on the 4Wings API, please refer to the official Global Fishing Watch API documentation:
See: https://globalfishingwatch.org/our-apis/documentation#map-visualization-4wings-api
- Returns:
- FourWingsResource:
The 4Wings data resource instance.
- property vessels: gfwapiclient.resources.VesselResource¶
Vessels data API resource.
Provides access to the Vessels API resources, which allow users to search for and retrieve information about vessels using various criteria.
For more details on the Vessels API, please refer to the official Global Fishing Watch API documentation:
See: https://globalfishingwatch.org/our-apis/documentation#vessels-api
- Returns:
- VesselResource:
The Vessels data resource instance.
- property events: gfwapiclient.resources.EventResource¶
Events data API resource.
Provides access to the Events API resources, which allow users to retrieve information about various vessel activities.
For more details on the Events API, refer to the official Global Fishing Watch API documentation:
See: https://globalfishingwatch.org/our-apis/documentation#events-api
- Returns:
- EventResource:
The Events data resource instance.
- property insights: gfwapiclient.resources.InsightResource¶
Insights data API resource.
Provides access to the Insights API resources, which allow users to retrieve insights data for specified vessels.
For more details on the Insights API, please refer to the official Global Fishing Watch API documentation:
See: https://globalfishingwatch.org/our-apis/documentation#insights-api
- Returns:
- InsightResource:
The insights data resource instance.
- property references: gfwapiclient.resources.ReferenceResource¶
References data API resource.
Provides access to the reference data resources, specifically regions.
Regions provide geographic data, such as Exclusive Economic Zones (EEZs), Marine Protected Areas (MPAs), and Regional Fisheries Management Organizations (RFMOs).
For more details on the Regions API, please refer to the official Global Fishing Watch API documentation:
See: https://globalfishingwatch.org/our-apis/documentation#regions
- Returns:
- ReferenceResource:
The reference data resource instance.