Provider#

class eodag.api.provider.Provider(config)[source]#

Represents a data provider with its configuration and utility methods.

Parameters:

Example#

>>> from eodag.api.provider import Provider
>>> config = {
...     'name': 'example_provider',
...     'description': 'Example provider for testing',
...     'search': {'type': 'StacSearch'},
...     'products': {'S2_MSI_L1C': {'_collection': 'S2_MSI_L1C'}}
... }
>>> provider = Provider(config)
>>> provider.name
'example_provider'
>>> 'S2_MSI_L1C' in provider.collections_config
True
>>> provider.priority  # Default priority
0
property api_config: PluginConfig | None#

Return the api plugin config, if any.

property collections_config: dict[str, Any]#

Return the collections configuration dictionary for this provider.

property config: ProviderConfig#

Provider configuration (read-only assignment).

To update configuration safely, use update_from_config() which handles metadata mapping and other provider-specific logic.

Note: Direct config modification (config.update(), config.name = ...) bypasses important provider validation.

delete_collection(name)[source]#

Remove a collection from this provider.

Parameters:

name (str) – The collection name.

Raises:

UnsupportedCollection – If the collection is not found.

Return type:

None

property download_config: PluginConfig | None#

Return the download plugin config, if any.

property fetchable: bool#

Return True if the provider can fetch collections.

property group: str | None#

Return the provider’s group, if any.

property name: str#

The name of the provider.

property priority: int#

Return the provider’s priority (default: 0).

property search_config: PluginConfig | None#

Return the search plugin config, if any.

sync_collections(dag, strict_mode)[source]#

Synchronize collections for a provider based on strict or permissive mode.

In strict mode, removes collections not in collections_config. In permissive mode, adds empty collection to config for missing types.

Parameters:
  • dag (EODataAccessGateway) – The gateway instance to use to list existing collections and to create new collection instances.

  • strict_mode (bool) – If True, remove unknown collections; if False, add empty configs for them.

Return type:

None

property title: str | None#

The title of the provider.

property unparsable_properties: set[str]#

Return set of unparsable properties from generic_collection_unparsable_properties, if any.

update_from_config(config)[source]#

Update the provider’s configuration from a given config.

Parameters:

config (ProviderConfig | dict[str, Any]) – The new configuration to update from.

Raises:

ValidationError – If the config attempts to change the provider name.

Return type:

None

property url: str | None#

The url of the provider.

class eodag.api.provider.ProviderConfig[source]#

EODAG configuration for a provider.

Parameters:
  • name – The name of the provider

  • priority – (optional) The priority of the provider while searching a product. Lower value means lower priority. (Default: 0)

  • roles – The roles of the provider (e.g. “host”, “producer”, “licensor”, “processor”)

  • description – (optional) A short description of the provider

  • url – URL to the webpage representing the provider

  • api – (optional) The configuration of a plugin of type Api

  • search – (optional) The configuration of a plugin of type Search

  • products – (optional) The collections supported by the provider

  • download – (optional) The configuration of a plugin of type Download

  • auth – (optional) The configuration of a plugin of type Authentication

  • search_auth – (optional) The configuration of a plugin of type Authentication for search

  • download_auth – (optional) The configuration of a plugin of type Authentication for download

  • kwargs – Additional configuration variables for this provider

classmethod from_mapping(mapping)[source]#

Build a ProviderConfig from a mapping

Parameters:

mapping (dict[str, Any])

Return type:

Self

classmethod from_yaml(loader, node)[source]#

Build a ProviderConfig from Yaml

Parameters:
  • loader (Loader)

  • node (Any)

Return type:

Self

update(config)[source]#

Update the configuration parameters with values from mapping

Parameters:

config (Self | dict[str, Any]) – The config from which to override configuration parameters

Return type:

None

static validate(config_keys, check_name=True)[source]#

Validate a ProviderConfig

Parameters:
  • config_keys (tuple[str, ...] | dict[str, Any]) – The configurations keys to validate

  • check_name (bool, default: True) – Whether to require ‘name’ key (default True). Set to False for legacy YAML tag parsing.

Return type:

None

with_name(new_name)[source]#

Create a copy of this ProviderConfig with a different name.

Parameters:

new_name (str) – The new name for the provider config.

Return type:

Self

Returns:

A new ProviderConfig instance with the updated name.

yaml_loader#

alias of Loader

class eodag.api.provider.ProvidersDict(*args, **kwargs)[source]#

A dictionary-like collection of Provider objects, keyed by provider name.

Parameters:
  • providers – Initial providers to populate the dictionary.

  • args (Any)

  • kwargs (Any)

check_supported(provider, include_groups=False)[source]#

Check that a provider or provider group is known in the provider registry.

Providers removed from the active registry are reported using their stored prune reason. This method does not inspect plugin loading state directly; plugin-related prune reasons must be recorded by the pruning code.

Parameters:
  • provider (str) – The name of the provider (or group, if include_groups) to check.

  • include_groups (bool, default: False) – Whether a provider group name is also accepted as known.

Raises:
  • MisconfiguredError – If the provider was pruned for a configuration reason.

  • UnsupportedProvider – If the provider/group is unknown, or if the provider was pruned because a required plugin was skipped.

Return type:

None

property configs: dict[str, ProviderConfig]#

Dictionary of provider configs keyed by provider name.

Returns:

Dictionary mapping provider name to ProviderConfig.

delete_collection(provider, collection)[source]#

Delete a collection from a provider.

Parameters:
  • provider (str) – The provider’s name.

  • product_ID – The collection to delete.

  • collection (str)

Raises:

UnsupportedProvider – If the provider or product is not found.

Return type:

None

filter(q=None)[source]#

Return providers whose name, group, description, URL or collection matches the free-text query.

Supports logical operators with parenthesis (AND/OR/NOT), quoted phrases ("exact phrase"), * and ? wildcards.

If no query is provided, returns all providers.

Parameters:

q (str | None, default: None) – Free-text parameter to filter providers. If None, returns all providers.

Return type:

ProvidersDict

Returns:

matching Provider objects in a ProvidersDict.

Example#

>>> from eodag.api.provider import ProvidersDict, Provider
>>> providers = ProvidersDict()
>>> providers['test1'] = Provider({
...     'name': 'test1',
...     'description': 'Satellite data',
...     'search': {'type': 'StacSearch'}
... })
>>> providers['test2'] = Provider({
...     'name': 'test2',
...     'description': 'Weather data',
...     'search': {'type': 'StacSearch'}
... })
>>> # Filter by description content
>>> providers.filter('Satellite')
ProvidersDict(['test1'])
>>> # Filter with logical operators
>>> providers['test3'] = Provider({
...     'name': 'test3',
...     'description': 'Satellite weather data',
...     'search': {'type': 'StacSearch'}
... })
>>> providers.filter('Satellite AND weather')
ProvidersDict(['test3'])
>>> # Get all providers when no filter
>>> len(providers.filter())
3
filter_by_name_or_group(name_or_group=None)[source]#

Yield providers whose name or group matches the given name_or_group.

If name_or_group is None, yields all providers.

Parameters:

name_or_group (str | None, default: None) – The provider name or group to filter by. If None, yields all providers.

Return type:

Iterator[Provider]

Returns:

Iterator of matching Provider objects.

Example#

>>> from eodag.api.provider import ProvidersDict, Provider
>>> providers = ProvidersDict()
>>> providers['sentinel'] = Provider({'name': 'sentinel', 'group': 'esa', 'search': {'type': 'StacSearch'}})
>>> providers['landsat'] = Provider({'name': 'landsat', 'group': 'usgs', 'search': {'type': 'StacSearch'}})
>>> providers['modis'] = Provider({'name': 'modis', 'group': 'nasa', 'search': {'type': 'StacSearch'}})
>>>
>>> # Filter by exact provider name
>>> list(p.name for p in providers.filter_by_name_or_group('sentinel'))
['sentinel']
>>>
>>> # Filter by group (case-insensitive)
>>> list(p.name for p in providers.filter_by_name_or_group('ESA'))
['sentinel']
>>>
>>> # Get all providers when no filter
>>> len(list(providers.filter_by_name_or_group()))
3
classmethod from_configs(configs, whitelist=None)[source]#

Build a ProvidersDict from a configuration mapping.

Parameters:
Return type:

Self

Returns:

An instance of ProvidersDict populated with the given configurations.

get_config(provider)[source]#

Get a ProviderConfig from provider name.

Parameters:

provider (str) – The provider name.

Return type:

ProviderConfig | None

Returns:

The ProviderConfig if found, otherwise None.

property groups: list[str]#

List of provider groups if exist or names.

Returns:

List of provider groups if exist or names.

property names: list[str]#

List of provider names.

Returns:

List of provider names.

property priorities: dict[str, int]#

Dictionary of provider priorities keyed by provider name.

Returns:

Dictionary mapping provider name to priority integer.

update_from_config_file(file_path)[source]#

Override provider configurations with values loaded from a YAML file.

Parameters:

file_path (str) – The path to the configuration file.

Raises:

yaml.parser.ParserError – If the YAML file cannot be parsed.

Return type:

None

update_from_configs(configs)[source]#

Update providers from a dictionary of configurations.

Parameters:

configs (Mapping[str, ProviderConfig | dict[str, Any]]) – A dictionary mapping provider names to configurations.

Return type:

None

update_from_env()[source]#

Override provider configurations with environment variables values.

Environment variables must start with EODAG__ and follow a nested key pattern separated by double underscores __.

Return type:

None