eodag 3.0.1__py3-none-any.whl → 3.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- eodag/api/core.py +174 -138
- eodag/api/product/_assets.py +44 -15
- eodag/api/product/_product.py +58 -47
- eodag/api/product/drivers/__init__.py +81 -4
- eodag/api/product/drivers/base.py +65 -4
- eodag/api/product/drivers/generic.py +65 -0
- eodag/api/product/drivers/sentinel1.py +97 -0
- eodag/api/product/drivers/sentinel2.py +95 -0
- eodag/api/product/metadata_mapping.py +117 -90
- eodag/api/search_result.py +13 -23
- eodag/cli.py +26 -5
- eodag/config.py +86 -92
- eodag/plugins/apis/base.py +1 -1
- eodag/plugins/apis/ecmwf.py +42 -22
- eodag/plugins/apis/usgs.py +17 -16
- eodag/plugins/authentication/aws_auth.py +16 -13
- eodag/plugins/authentication/base.py +5 -3
- eodag/plugins/authentication/header.py +3 -3
- eodag/plugins/authentication/keycloak.py +4 -4
- eodag/plugins/authentication/oauth.py +7 -3
- eodag/plugins/authentication/openid_connect.py +22 -16
- eodag/plugins/authentication/sas_auth.py +4 -4
- eodag/plugins/authentication/token.py +41 -10
- eodag/plugins/authentication/token_exchange.py +1 -1
- eodag/plugins/base.py +4 -4
- eodag/plugins/crunch/base.py +4 -4
- eodag/plugins/crunch/filter_date.py +4 -4
- eodag/plugins/crunch/filter_latest_intersect.py +6 -6
- eodag/plugins/crunch/filter_latest_tpl_name.py +7 -7
- eodag/plugins/crunch/filter_overlap.py +4 -4
- eodag/plugins/crunch/filter_property.py +6 -7
- eodag/plugins/download/aws.py +146 -87
- eodag/plugins/download/base.py +38 -56
- eodag/plugins/download/creodias_s3.py +29 -0
- eodag/plugins/download/http.py +173 -183
- eodag/plugins/download/s3rest.py +10 -11
- eodag/plugins/manager.py +10 -20
- eodag/plugins/search/__init__.py +6 -5
- eodag/plugins/search/base.py +90 -46
- eodag/plugins/search/build_search_result.py +1048 -361
- eodag/plugins/search/cop_marine.py +22 -12
- eodag/plugins/search/creodias_s3.py +9 -73
- eodag/plugins/search/csw.py +11 -11
- eodag/plugins/search/data_request_search.py +19 -18
- eodag/plugins/search/qssearch.py +99 -258
- eodag/plugins/search/stac_list_assets.py +85 -0
- eodag/plugins/search/static_stac_search.py +4 -4
- eodag/resources/ext_product_types.json +1 -1
- eodag/resources/product_types.yml +1134 -325
- eodag/resources/providers.yml +906 -2006
- eodag/resources/stac_api.yml +2 -2
- eodag/resources/user_conf_template.yml +10 -9
- eodag/rest/cache.py +2 -2
- eodag/rest/config.py +3 -3
- eodag/rest/core.py +112 -82
- eodag/rest/errors.py +5 -5
- eodag/rest/server.py +33 -14
- eodag/rest/stac.py +41 -38
- eodag/rest/types/collections_search.py +3 -3
- eodag/rest/types/eodag_search.py +29 -23
- eodag/rest/types/queryables.py +42 -31
- eodag/rest/types/stac_search.py +15 -25
- eodag/rest/utils/__init__.py +14 -21
- eodag/rest/utils/cql_evaluate.py +6 -6
- eodag/rest/utils/rfc3339.py +2 -2
- eodag/types/__init__.py +141 -32
- eodag/types/bbox.py +2 -2
- eodag/types/download_args.py +3 -3
- eodag/types/queryables.py +183 -72
- eodag/types/search_args.py +4 -4
- eodag/types/whoosh.py +127 -3
- eodag/utils/__init__.py +153 -51
- eodag/utils/exceptions.py +28 -21
- eodag/utils/import_system.py +2 -2
- eodag/utils/repr.py +65 -6
- eodag/utils/requests.py +13 -13
- eodag/utils/rest.py +2 -2
- eodag/utils/s3.py +231 -0
- eodag/utils/stac_reader.py +10 -10
- {eodag-3.0.1.dist-info → eodag-3.1.0.dist-info}/METADATA +77 -76
- eodag-3.1.0.dist-info/RECORD +113 -0
- {eodag-3.0.1.dist-info → eodag-3.1.0.dist-info}/WHEEL +1 -1
- {eodag-3.0.1.dist-info → eodag-3.1.0.dist-info}/entry_points.txt +4 -2
- eodag/utils/constraints.py +0 -244
- eodag-3.0.1.dist-info/RECORD +0 -109
- {eodag-3.0.1.dist-info → eodag-3.1.0.dist-info}/LICENSE +0 -0
- {eodag-3.0.1.dist-info → eodag-3.1.0.dist-info}/top_level.txt +0 -0
eodag/config.py
CHANGED
|
@@ -20,17 +20,15 @@ from __future__ import annotations
|
|
|
20
20
|
import logging
|
|
21
21
|
import os
|
|
22
22
|
import tempfile
|
|
23
|
+
from importlib.resources import files as res_files
|
|
23
24
|
from inspect import isclass
|
|
24
25
|
from typing import (
|
|
25
26
|
Annotated,
|
|
26
27
|
Any,
|
|
27
|
-
Dict,
|
|
28
28
|
ItemsView,
|
|
29
29
|
Iterator,
|
|
30
|
-
List,
|
|
31
30
|
Literal,
|
|
32
31
|
Optional,
|
|
33
|
-
Tuple,
|
|
34
32
|
TypedDict,
|
|
35
33
|
Union,
|
|
36
34
|
ValuesView,
|
|
@@ -44,7 +42,6 @@ import yaml.constructor
|
|
|
44
42
|
import yaml.parser
|
|
45
43
|
from annotated_types import Gt
|
|
46
44
|
from jsonpath_ng import JSONPath
|
|
47
|
-
from pkg_resources import resource_filename
|
|
48
45
|
|
|
49
46
|
from eodag.api.product.metadata_mapping import mtd_cfg_as_conversion_and_querypath
|
|
50
47
|
from eodag.utils import (
|
|
@@ -79,7 +76,7 @@ class SimpleYamlProxyConfig:
|
|
|
79
76
|
|
|
80
77
|
def __init__(self, conf_file_path: str) -> None:
|
|
81
78
|
try:
|
|
82
|
-
self.source:
|
|
79
|
+
self.source: dict[str, Any] = cached_yaml_load(conf_file_path)
|
|
83
80
|
except yaml.parser.ParserError as e:
|
|
84
81
|
print("Unable to load user configuration file")
|
|
85
82
|
raise e
|
|
@@ -127,12 +124,12 @@ class ProviderConfig(yaml.YAMLObject):
|
|
|
127
124
|
name: str
|
|
128
125
|
group: str
|
|
129
126
|
priority: int = 0 # Set default priority to 0
|
|
130
|
-
roles:
|
|
127
|
+
roles: list[str]
|
|
131
128
|
description: str
|
|
132
129
|
url: str
|
|
133
130
|
api: PluginConfig
|
|
134
131
|
search: PluginConfig
|
|
135
|
-
products:
|
|
132
|
+
products: dict[str, Any]
|
|
136
133
|
download: PluginConfig
|
|
137
134
|
auth: PluginConfig
|
|
138
135
|
search_auth: PluginConfig
|
|
@@ -154,7 +151,7 @@ class ProviderConfig(yaml.YAMLObject):
|
|
|
154
151
|
return loader.construct_yaml_object(node, cls)
|
|
155
152
|
|
|
156
153
|
@classmethod
|
|
157
|
-
def from_mapping(cls, mapping:
|
|
154
|
+
def from_mapping(cls, mapping: dict[str, Any]) -> ProviderConfig:
|
|
158
155
|
"""Build a :class:`~eodag.config.ProviderConfig` from a mapping"""
|
|
159
156
|
cls.validate(mapping)
|
|
160
157
|
for key in PLUGINS_TOPICS_KEYS:
|
|
@@ -165,7 +162,7 @@ class ProviderConfig(yaml.YAMLObject):
|
|
|
165
162
|
return c
|
|
166
163
|
|
|
167
164
|
@staticmethod
|
|
168
|
-
def validate(config_keys: Union[
|
|
165
|
+
def validate(config_keys: Union[tuple[str, ...], dict[str, Any]]) -> None:
|
|
169
166
|
"""Validate a :class:`~eodag.config.ProviderConfig`
|
|
170
167
|
|
|
171
168
|
:param config_keys: The configurations keys to validate
|
|
@@ -181,7 +178,7 @@ class ProviderConfig(yaml.YAMLObject):
|
|
|
181
178
|
"type of plugin"
|
|
182
179
|
)
|
|
183
180
|
|
|
184
|
-
def update(self, mapping: Optional[
|
|
181
|
+
def update(self, mapping: Optional[dict[str, Any]]) -> None:
|
|
185
182
|
"""Update the configuration parameters with values from `mapping`
|
|
186
183
|
|
|
187
184
|
:param mapping: The mapping from which to override configuration parameters
|
|
@@ -197,7 +194,7 @@ class ProviderConfig(yaml.YAMLObject):
|
|
|
197
194
|
},
|
|
198
195
|
)
|
|
199
196
|
for key in PLUGINS_TOPICS_KEYS:
|
|
200
|
-
current_value: Optional[
|
|
197
|
+
current_value: Optional[dict[str, Any]] = getattr(self, key, None)
|
|
201
198
|
mapping_value = mapping.get(key, {})
|
|
202
199
|
if current_value is not None:
|
|
203
200
|
current_value.update(mapping_value)
|
|
@@ -240,14 +237,14 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
240
237
|
"""Configuration for sort during search"""
|
|
241
238
|
|
|
242
239
|
#: Default sort settings
|
|
243
|
-
sort_by_default:
|
|
240
|
+
sort_by_default: list[tuple[str, str]]
|
|
244
241
|
#: F-string template to add to :attr:`~eodag.config.PluginConfig.Pagination.next_page_url_tpl` to sort search
|
|
245
242
|
#: results
|
|
246
243
|
sort_by_tpl: str
|
|
247
244
|
#: Mapping between eodag and provider query parameters used for sort
|
|
248
|
-
sort_param_mapping:
|
|
245
|
+
sort_param_mapping: dict[str, str]
|
|
249
246
|
#: Mapping between eodag and provider sort-order parameters
|
|
250
|
-
sort_order_mapping:
|
|
247
|
+
sort_order_mapping: dict[Literal["ascending", "descending"], str]
|
|
251
248
|
#: Maximum number of allowed sort parameters per request
|
|
252
249
|
max_sort_params: Annotated[int, Gt(0)]
|
|
253
250
|
|
|
@@ -271,7 +268,7 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
271
268
|
#: HTTP method used to fetch product types
|
|
272
269
|
fetch_method: str
|
|
273
270
|
#: Request body to fetch product types using POST method
|
|
274
|
-
fetch_body:
|
|
271
|
+
fetch_body: dict[str, Any]
|
|
275
272
|
#: Maximum number of connections for concurrent HTTP requests
|
|
276
273
|
max_connections: int
|
|
277
274
|
#: The f-string template for pagination requests.
|
|
@@ -286,15 +283,17 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
286
283
|
generic_product_type_id: str
|
|
287
284
|
#: Mapping for product type metadata (e.g. ``abstract``, ``licence``) which can be parsed from the provider
|
|
288
285
|
#: result
|
|
289
|
-
generic_product_type_parsable_metadata:
|
|
290
|
-
#: Mapping for product type properties which can be parsed from the result
|
|
291
|
-
generic_product_type_parsable_properties:
|
|
286
|
+
generic_product_type_parsable_metadata: dict[str, str]
|
|
287
|
+
#: Mapping for product type properties which can be parsed from the result and are not product type metadata
|
|
288
|
+
generic_product_type_parsable_properties: dict[str, str]
|
|
289
|
+
#: Mapping for product type properties which cannot be parsed from the result and are not product type metadata
|
|
290
|
+
generic_product_type_unparsable_properties: dict[str, str]
|
|
292
291
|
#: URL to fetch data for a single collection
|
|
293
292
|
single_collection_fetch_url: str
|
|
294
293
|
#: Query string to be added to the fetch_url to filter for a collection
|
|
295
294
|
single_collection_fetch_qs: str
|
|
296
295
|
#: Mapping for product type metadata returned by the endpoint given in single_collection_fetch_url
|
|
297
|
-
single_product_type_parsable_metadata:
|
|
296
|
+
single_product_type_parsable_metadata: dict[str, str]
|
|
298
297
|
|
|
299
298
|
class DiscoverQueryables(TypedDict, total=False):
|
|
300
299
|
"""Configuration for queryables discovery"""
|
|
@@ -307,12 +306,16 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
307
306
|
result_type: str
|
|
308
307
|
#: JsonPath to retrieve the queryables from the provider result
|
|
309
308
|
results_entry: str
|
|
309
|
+
#: :class:`~eodag.plugins.search.base.Search` URL of the constraint file used to build queryables
|
|
310
|
+
constraints_url: str
|
|
311
|
+
#: :class:`~eodag.plugins.search.base.Search` Key in the json result where the constraints can be found
|
|
312
|
+
constraints_entry: str
|
|
310
313
|
|
|
311
314
|
class OrderOnResponse(TypedDict):
|
|
312
315
|
"""Configuration for order on-response during download"""
|
|
313
316
|
|
|
314
317
|
#: Parameters metadata-mapping to apply to the order response
|
|
315
|
-
metadata_mapping:
|
|
318
|
+
metadata_mapping: dict[str, Union[str, list[str]]]
|
|
316
319
|
|
|
317
320
|
class OrderStatusSuccess(TypedDict):
|
|
318
321
|
"""
|
|
@@ -345,7 +348,7 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
345
348
|
#: Request HTTP method
|
|
346
349
|
method: str
|
|
347
350
|
#: Request hearders
|
|
348
|
-
headers:
|
|
351
|
+
headers: dict[str, Any]
|
|
349
352
|
|
|
350
353
|
class OrderStatusOnSuccess(TypedDict, total=False):
|
|
351
354
|
"""Configuration for order status on-success during download"""
|
|
@@ -357,7 +360,7 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
357
360
|
#: Key in the success response that gives access to the result
|
|
358
361
|
results_entry: str
|
|
359
362
|
#: Metadata-mapping to apply to the success status result
|
|
360
|
-
metadata_mapping:
|
|
363
|
+
metadata_mapping: dict[str, Union[str, list[str]]]
|
|
361
364
|
|
|
362
365
|
class OrderStatus(TypedDict, total=False):
|
|
363
366
|
"""Configuration for order status during download"""
|
|
@@ -365,11 +368,11 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
365
368
|
#: Order status request configuration
|
|
366
369
|
request: PluginConfig.OrderStatusRequest
|
|
367
370
|
#: Metadata-mapping used to parse order status response
|
|
368
|
-
metadata_mapping:
|
|
371
|
+
metadata_mapping: dict[str, Union[str, list[str]]]
|
|
369
372
|
#: Configuration to identify order status success during download
|
|
370
373
|
success: PluginConfig.OrderStatusSuccess
|
|
371
374
|
#: Part of the order status response that tells there is an error
|
|
372
|
-
error:
|
|
375
|
+
error: dict[str, Any]
|
|
373
376
|
#: Configuration to identify order status ordered during download
|
|
374
377
|
ordered: PluginConfig.OrderStatusOrdered
|
|
375
378
|
#: Configuration for order status on-success during download
|
|
@@ -394,7 +397,7 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
394
397
|
#: :class:`~eodag.plugins.base.PluginTopic` Default s3 bucket
|
|
395
398
|
s3_bucket: str
|
|
396
399
|
#: :class:`~eodag.plugins.base.PluginTopic` Authentication error codes
|
|
397
|
-
auth_error_code: Union[int,
|
|
400
|
+
auth_error_code: Union[int, list[int]]
|
|
398
401
|
#: :class:`~eodag.plugins.base.PluginTopic` Time to wait until request timeout in seconds
|
|
399
402
|
timeout: float
|
|
400
403
|
#: :class:`~eodag.plugins.base.PluginTopic` :class:`urllib3.util.Retry` ``total`` parameter,
|
|
@@ -405,13 +408,13 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
405
408
|
retry_backoff_factor: int
|
|
406
409
|
#: :class:`~eodag.plugins.base.PluginTopic` :class:`urllib3.util.Retry` ``status_forcelist`` parameter,
|
|
407
410
|
#: list of integer HTTP status codes that we should force a retry on
|
|
408
|
-
retry_status_forcelist:
|
|
411
|
+
retry_status_forcelist: list[int]
|
|
409
412
|
|
|
410
413
|
# search & api -----------------------------------------------------------------------------------------------------
|
|
411
414
|
# copied from ProviderConfig in PluginManager.get_search_plugins()
|
|
412
415
|
priority: int
|
|
413
416
|
# per product type metadata-mapping, set in core._prepare_search
|
|
414
|
-
product_type_config:
|
|
417
|
+
product_type_config: dict[str, Any]
|
|
415
418
|
|
|
416
419
|
#: :class:`~eodag.plugins.search.base.Search` Plugin API endpoint
|
|
417
420
|
api_endpoint: str
|
|
@@ -433,26 +436,15 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
433
436
|
#: :class:`~eodag.plugins.search.base.Search` Configuration for the queryables auto-discovery
|
|
434
437
|
discover_queryables: PluginConfig.DiscoverQueryables
|
|
435
438
|
#: :class:`~eodag.plugins.search.base.Search` The mapping between eodag metadata and the plugin specific metadata
|
|
436
|
-
metadata_mapping:
|
|
437
|
-
#: :class:`~eodag.plugins.search.base.Search` URL of the constraint file used to build queryables
|
|
438
|
-
constraints_file_url: str
|
|
439
|
-
#: :class:`~eodag.plugins.search.base.Search`
|
|
440
|
-
#: Key which is used in the eodag configuration to map the eodag product type to the provider product type
|
|
441
|
-
constraints_file_dataset_key: str
|
|
442
|
-
#: :class:`~eodag.plugins.search.base.Search` Key in the json result where the constraints can be found
|
|
443
|
-
constraints_entry: str
|
|
444
|
-
#: :class:`~eodag.plugins.search.base.Search`
|
|
445
|
-
#: Whether only a provider result containing constraints_entry is accepted as valid and used to create constraints
|
|
446
|
-
#: or not
|
|
447
|
-
stop_without_constraints_entry_key: bool
|
|
439
|
+
metadata_mapping: dict[str, Union[str, list[str]]]
|
|
448
440
|
#: :class:`~eodag.plugins.search.base.Search` Parameters to remove from queryables
|
|
449
|
-
remove_from_queryables:
|
|
441
|
+
remove_from_queryables: list[str]
|
|
450
442
|
#: :class:`~eodag.plugins.search.base.Search` Parameters to be passed as is in the search url query string
|
|
451
|
-
literal_search_params:
|
|
443
|
+
literal_search_params: dict[str, str]
|
|
452
444
|
#: :class:`~eodag.plugins.search.qssearch.QueryStringSearch` Characters that should not be quoted in the url params
|
|
453
|
-
dont_quote:
|
|
445
|
+
dont_quote: list[str]
|
|
454
446
|
#: :class:`~eodag.plugins.search.qssearch.ODataV4Search` Dict describing free text search request build
|
|
455
|
-
free_text_search_operations:
|
|
447
|
+
free_text_search_operations: dict[str, Any]
|
|
456
448
|
#: :class:`~eodag.plugins.search.qssearch.ODataV4Search` Set to ``True`` if the metadata is not given in the search
|
|
457
449
|
#: result and a two step search has to be performed
|
|
458
450
|
per_product_metadata_query: bool
|
|
@@ -469,23 +461,25 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
469
461
|
#: if date parameters are mandatory in the request
|
|
470
462
|
dates_required: bool
|
|
471
463
|
#: :class:`~eodag.plugins.search.csw.CSWSearch` Search definition dictionary
|
|
472
|
-
search_definition:
|
|
464
|
+
search_definition: dict[str, Any]
|
|
473
465
|
#: :class:`~eodag.plugins.search.qssearch.PostJsonSearch` Whether to merge responses or not (`aws_eos` specific)
|
|
474
466
|
merge_responses: bool
|
|
475
467
|
#: :class:`~eodag.plugins.search.qssearch.PostJsonSearch` Collections names (`aws_eos` specific)
|
|
476
|
-
collection:
|
|
468
|
+
collection: list[str]
|
|
477
469
|
#: :class:`~eodag.plugins.search.static_stac_search.StaticStacSearch`
|
|
478
470
|
#: Maximum number of connections for concurrent HTTP requests
|
|
479
471
|
max_connections: int
|
|
480
|
-
#: :class:`~eodag.plugins.search.build_search_result.
|
|
472
|
+
#: :class:`~eodag.plugins.search.build_search_result.ECMWFSearch`
|
|
481
473
|
#: Whether end date should be excluded from search request or not
|
|
482
474
|
end_date_excluded: bool
|
|
483
|
-
#: :class:`~eodag.plugins.search.build_search_result.
|
|
475
|
+
#: :class:`~eodag.plugins.search.build_search_result.ECMWFSearch`
|
|
484
476
|
#: List of parameters used to parse metadata but that must not be included to the query
|
|
485
|
-
remove_from_query:
|
|
477
|
+
remove_from_query: list[str]
|
|
486
478
|
#: :class:`~eodag.plugins.search.csw.CSWSearch`
|
|
487
479
|
#: OGC Catalogue Service version
|
|
488
480
|
version: str
|
|
481
|
+
#: :class:`~eodag.plugins.apis.ecmwf.EcmwfApi` url of the authentication endpoint
|
|
482
|
+
auth_endpoint: str
|
|
489
483
|
|
|
490
484
|
# download ---------------------------------------------------------------------------------------------------------
|
|
491
485
|
#: :class:`~eodag.plugins.download.base.Download` Default endpoint url
|
|
@@ -504,13 +498,13 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
504
498
|
#: :class:`~eodag.plugins.download.base.Download` Whether ignore assets and download using ``downloadLink`` or not
|
|
505
499
|
ignore_assets: bool
|
|
506
500
|
#: :class:`~eodag.plugins.download.base.Download` Product type specific configuration
|
|
507
|
-
products:
|
|
501
|
+
products: dict[str, dict[str, Any]]
|
|
508
502
|
#: :class:`~eodag.plugins.download.http.HTTPDownload` Whether the product has to be ordered to download it or not
|
|
509
503
|
order_enabled: bool
|
|
510
504
|
#: :class:`~eodag.plugins.download.http.HTTPDownload` HTTP request method for the order request
|
|
511
505
|
order_method: str
|
|
512
506
|
#: :class:`~eodag.plugins.download.http.HTTPDownload` Headers to be added to the order request
|
|
513
|
-
order_headers:
|
|
507
|
+
order_headers: dict[str, str]
|
|
514
508
|
#: :class:`~eodag.plugins.download.http.HTTPDownload`
|
|
515
509
|
#: Dictionary containing the key :attr:`~eodag.config.PluginConfig.metadata_mapping` which can be used to add new
|
|
516
510
|
#: product properties based on the data in response to the order request
|
|
@@ -521,7 +515,7 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
521
515
|
#: Do not authenticate the download request but only the order and order status ones
|
|
522
516
|
no_auth_download: bool
|
|
523
517
|
#: :class:`~eodag.plugins.download.http.HTTPDownload` Parameters to be added to the query params of the request
|
|
524
|
-
dl_url_params:
|
|
518
|
+
dl_url_params: dict[str, str]
|
|
525
519
|
#: :class:`~eodag.plugins.download.s3rest.S3RestDownload`
|
|
526
520
|
#: At which level of the path part of the url the bucket can be found
|
|
527
521
|
bucket_path_level: int
|
|
@@ -532,12 +526,15 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
532
526
|
|
|
533
527
|
# auth -------------------------------------------------------------------------------------------------------------
|
|
534
528
|
#: :class:`~eodag.plugins.authentication.base.Authentication` Authentication credentials dictionary
|
|
535
|
-
credentials:
|
|
529
|
+
credentials: dict[str, str]
|
|
536
530
|
#: :class:`~eodag.plugins.authentication.base.Authentication` Authentication URL
|
|
537
531
|
auth_uri: str
|
|
538
532
|
#: :class:`~eodag.plugins.authentication.base.Authentication`
|
|
539
533
|
#: Dictionary containing all keys/value pairs that should be added to the headers
|
|
540
|
-
headers:
|
|
534
|
+
headers: dict[str, str]
|
|
535
|
+
#: :class:`~eodag.plugins.authentication.base.Authentication`
|
|
536
|
+
#: Dictionary containing all keys/value pairs that should be added to the headers for token retrieve only
|
|
537
|
+
retrieve_headers: dict[str, str]
|
|
541
538
|
#: :class:`~eodag.plugins.authentication.base.Authentication`
|
|
542
539
|
#: The key pointing to the token in the response from the token server
|
|
543
540
|
token_key: str
|
|
@@ -549,7 +546,7 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
549
546
|
matching_url: str
|
|
550
547
|
#: :class:`~eodag.plugins.authentication.base.Authentication` Part of the search or download plugin configuration
|
|
551
548
|
#: that needs authentication
|
|
552
|
-
matching_conf:
|
|
549
|
+
matching_conf: dict[str, Any]
|
|
553
550
|
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCRefreshTokenBase`
|
|
554
551
|
#: How the token should be used in the request
|
|
555
552
|
token_provision: str
|
|
@@ -561,7 +558,7 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
561
558
|
#: The OIDC provider's ``.well-known/openid-configuration`` url.
|
|
562
559
|
oidc_config_url: str
|
|
563
560
|
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCRefreshTokenBase` The OIDC token audiences
|
|
564
|
-
allowed_audiences:
|
|
561
|
+
allowed_audiences: list[str]
|
|
565
562
|
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
566
563
|
#: Whether a user consent is needed during the authentication or not
|
|
567
564
|
user_consent_needed: str
|
|
@@ -585,16 +582,16 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
585
582
|
user_consent_form_xpath: str
|
|
586
583
|
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
587
584
|
#: The data that will be passed with the POST request on the form 'action' URL
|
|
588
|
-
user_consent_form_data:
|
|
585
|
+
user_consent_form_data: dict[str, str]
|
|
589
586
|
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
590
587
|
#: Additional data to be passed to the login POST request
|
|
591
|
-
additional_login_form_data:
|
|
588
|
+
additional_login_form_data: dict[str, str]
|
|
592
589
|
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
593
590
|
#: Key/value pairs of patterns/messages used for Authentication errors
|
|
594
|
-
exchange_url_error_pattern:
|
|
591
|
+
exchange_url_error_pattern: dict[str, str]
|
|
595
592
|
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
596
593
|
#: A mapping between OIDC url query string and token handler query string params
|
|
597
|
-
token_exchange_params:
|
|
594
|
+
token_exchange_params: dict[str, str]
|
|
598
595
|
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
599
596
|
#: Refers to the name of the query param to be used in the query request
|
|
600
597
|
token_qs_key: str
|
|
@@ -608,7 +605,7 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
608
605
|
signed_url_key: str
|
|
609
606
|
#: :class:`~eodag.plugins.authentication.token.TokenAuth`
|
|
610
607
|
#: Credentials json structure if they should be sent as POST data
|
|
611
|
-
req_data:
|
|
608
|
+
req_data: dict[str, Any]
|
|
612
609
|
#: :class:`~eodag.plugins.authentication.token.TokenAuth`
|
|
613
610
|
#: URL used to fetch the access token with a refresh token
|
|
614
611
|
refresh_uri: str
|
|
@@ -618,7 +615,7 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
618
615
|
#: :class:`~eodag.plugins.authentication.token_exchange.OIDCTokenExchangeAuth`
|
|
619
616
|
#: The full :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth` plugin configuration
|
|
620
617
|
#: used to retrieve subject token
|
|
621
|
-
subject:
|
|
618
|
+
subject: dict[str, Any]
|
|
622
619
|
#: :class:`~eodag.plugins.authentication.token_exchange.OIDCTokenExchangeAuth`
|
|
623
620
|
#: Identifies the issuer of the `subject_token`
|
|
624
621
|
subject_issuer: str
|
|
@@ -640,21 +637,21 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
640
637
|
return loader.construct_yaml_object(node, cls)
|
|
641
638
|
|
|
642
639
|
@classmethod
|
|
643
|
-
def from_mapping(cls, mapping:
|
|
640
|
+
def from_mapping(cls, mapping: dict[str, Any]) -> PluginConfig:
|
|
644
641
|
"""Build a :class:`~eodag.config.PluginConfig` from a mapping"""
|
|
645
642
|
c = cls()
|
|
646
643
|
c.__dict__.update(mapping)
|
|
647
644
|
return c
|
|
648
645
|
|
|
649
646
|
@staticmethod
|
|
650
|
-
def validate(config_keys:
|
|
647
|
+
def validate(config_keys: tuple[Any, ...]) -> None:
|
|
651
648
|
"""Validate a :class:`~eodag.config.PluginConfig`"""
|
|
652
649
|
if "type" not in config_keys:
|
|
653
650
|
raise ValidationError(
|
|
654
651
|
"A Plugin config must specify the Plugin it configures"
|
|
655
652
|
)
|
|
656
653
|
|
|
657
|
-
def update(self, mapping: Optional[
|
|
654
|
+
def update(self, mapping: Optional[dict[Any, Any]]) -> None:
|
|
658
655
|
"""Update the configuration parameters with values from `mapping`
|
|
659
656
|
|
|
660
657
|
:param mapping: The mapping from which to override configuration parameters
|
|
@@ -666,7 +663,7 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
666
663
|
)
|
|
667
664
|
|
|
668
665
|
|
|
669
|
-
def load_default_config() ->
|
|
666
|
+
def load_default_config() -> dict[str, ProviderConfig]:
|
|
670
667
|
"""Load the providers configuration into a dictionary.
|
|
671
668
|
|
|
672
669
|
Load from eodag `resources/providers.yml` or `EODAG_PROVIDERS_CFG_FILE` environment
|
|
@@ -674,24 +671,24 @@ def load_default_config() -> Dict[str, ProviderConfig]:
|
|
|
674
671
|
|
|
675
672
|
:returns: The default provider's configuration
|
|
676
673
|
"""
|
|
677
|
-
eodag_providers_cfg_file = os.getenv(
|
|
678
|
-
"
|
|
679
|
-
)
|
|
674
|
+
eodag_providers_cfg_file = os.getenv("EODAG_PROVIDERS_CFG_FILE") or str(
|
|
675
|
+
res_files("eodag") / "resources" / "providers.yml"
|
|
676
|
+
)
|
|
680
677
|
return load_config(eodag_providers_cfg_file)
|
|
681
678
|
|
|
682
679
|
|
|
683
|
-
def load_config(config_path: str) ->
|
|
680
|
+
def load_config(config_path: str) -> dict[str, ProviderConfig]:
|
|
684
681
|
"""Load the providers configuration into a dictionary from a given file
|
|
685
682
|
|
|
686
683
|
:param config_path: The path to the provider config file
|
|
687
684
|
:returns: The default provider's configuration
|
|
688
685
|
"""
|
|
689
686
|
logger.debug("Loading configuration from %s", config_path)
|
|
690
|
-
config:
|
|
687
|
+
config: dict[str, ProviderConfig] = {}
|
|
691
688
|
try:
|
|
692
689
|
# Providers configs are stored in this file as separated yaml documents
|
|
693
690
|
# Load all of it
|
|
694
|
-
providers_configs:
|
|
691
|
+
providers_configs: list[ProviderConfig] = cached_yaml_load_all(config_path)
|
|
695
692
|
except yaml.parser.ParserError as e:
|
|
696
693
|
logger.error("Unable to load configuration")
|
|
697
694
|
raise e
|
|
@@ -714,7 +711,7 @@ def credentials_in_auth(auth_conf: PluginConfig) -> bool:
|
|
|
714
711
|
|
|
715
712
|
|
|
716
713
|
def share_credentials(
|
|
717
|
-
providers_config:
|
|
714
|
+
providers_config: dict[str, ProviderConfig],
|
|
718
715
|
) -> None:
|
|
719
716
|
"""Share credentials between plugins having the same matching criteria
|
|
720
717
|
|
|
@@ -758,7 +755,7 @@ def share_credentials(
|
|
|
758
755
|
|
|
759
756
|
def provider_config_init(
|
|
760
757
|
provider_config: ProviderConfig,
|
|
761
|
-
stac_search_default_conf: Optional[
|
|
758
|
+
stac_search_default_conf: Optional[dict[str, Any]] = None,
|
|
762
759
|
) -> None:
|
|
763
760
|
"""Applies some default values to provider config
|
|
764
761
|
|
|
@@ -782,6 +779,7 @@ def provider_config_init(
|
|
|
782
779
|
and provider_config.search.type
|
|
783
780
|
in [
|
|
784
781
|
"StacSearch",
|
|
782
|
+
"StacListAssets",
|
|
785
783
|
"StaticStacSearch",
|
|
786
784
|
]
|
|
787
785
|
):
|
|
@@ -796,7 +794,7 @@ def provider_config_init(
|
|
|
796
794
|
pass
|
|
797
795
|
|
|
798
796
|
|
|
799
|
-
def override_config_from_file(config:
|
|
797
|
+
def override_config_from_file(config: dict[str, Any], file_path: str) -> None:
|
|
800
798
|
"""Override a configuration with the values in a file
|
|
801
799
|
|
|
802
800
|
:param config: An eodag providers configuration dictionary
|
|
@@ -814,14 +812,14 @@ def override_config_from_file(config: Dict[str, Any], file_path: str) -> None:
|
|
|
814
812
|
override_config_from_mapping(config, config_in_file)
|
|
815
813
|
|
|
816
814
|
|
|
817
|
-
def override_config_from_env(config:
|
|
815
|
+
def override_config_from_env(config: dict[str, Any]) -> None:
|
|
818
816
|
"""Override a configuration with environment variables values
|
|
819
817
|
|
|
820
818
|
:param config: An eodag providers configuration dictionary
|
|
821
819
|
"""
|
|
822
820
|
|
|
823
821
|
def build_mapping_from_env(
|
|
824
|
-
env_var: str, env_value: str, mapping:
|
|
822
|
+
env_var: str, env_value: str, mapping: dict[str, Any]
|
|
825
823
|
) -> None:
|
|
826
824
|
"""Recursively build a dictionary from an environment variable.
|
|
827
825
|
|
|
@@ -872,7 +870,7 @@ def override_config_from_env(config: Dict[str, Any]) -> None:
|
|
|
872
870
|
new_map = mapping.setdefault(parts[0], {})
|
|
873
871
|
build_mapping_from_env("__".join(parts[1:]), env_value, new_map)
|
|
874
872
|
|
|
875
|
-
mapping_from_env:
|
|
873
|
+
mapping_from_env: dict[str, Any] = {}
|
|
876
874
|
for env_var in os.environ:
|
|
877
875
|
if env_var.startswith("EODAG__"):
|
|
878
876
|
build_mapping_from_env(
|
|
@@ -885,7 +883,7 @@ def override_config_from_env(config: Dict[str, Any]) -> None:
|
|
|
885
883
|
|
|
886
884
|
|
|
887
885
|
def override_config_from_mapping(
|
|
888
|
-
config:
|
|
886
|
+
config: dict[str, Any], mapping: dict[str, Any]
|
|
889
887
|
) -> None:
|
|
890
888
|
"""Override a configuration with the values in a mapping
|
|
891
889
|
|
|
@@ -923,7 +921,7 @@ def override_config_from_mapping(
|
|
|
923
921
|
)
|
|
924
922
|
|
|
925
923
|
# try overriding conf
|
|
926
|
-
old_conf: Optional[
|
|
924
|
+
old_conf: Optional[dict[str, Any]] = config.get(provider)
|
|
927
925
|
if old_conf is not None:
|
|
928
926
|
old_conf.update(new_conf)
|
|
929
927
|
else:
|
|
@@ -944,7 +942,7 @@ def override_config_from_mapping(
|
|
|
944
942
|
logger.debug(tb.format_exc())
|
|
945
943
|
|
|
946
944
|
|
|
947
|
-
def merge_configs(config:
|
|
945
|
+
def merge_configs(config: dict[str, Any], other_config: dict[str, Any]) -> None:
|
|
948
946
|
"""Override a configuration with the values of another configuration
|
|
949
947
|
|
|
950
948
|
:param config: An eodag providers configuration dictionary
|
|
@@ -976,7 +974,7 @@ def merge_configs(config: Dict[str, Any], other_config: Dict[str, Any]) -> None:
|
|
|
976
974
|
config[provider] = new_conf
|
|
977
975
|
|
|
978
976
|
|
|
979
|
-
def load_yml_config(yml_path: str) ->
|
|
977
|
+
def load_yml_config(yml_path: str) -> dict[Any, Any]:
|
|
980
978
|
"""Load a conf dictionary from given yml absolute path
|
|
981
979
|
|
|
982
980
|
:returns: The yml configuration file
|
|
@@ -985,39 +983,35 @@ def load_yml_config(yml_path: str) -> Dict[Any, Any]:
|
|
|
985
983
|
return dict_items_recursive_apply(config.source, string_to_jsonpath)
|
|
986
984
|
|
|
987
985
|
|
|
988
|
-
def load_stac_config() ->
|
|
986
|
+
def load_stac_config() -> dict[str, Any]:
|
|
989
987
|
"""Load the stac configuration into a dictionary
|
|
990
988
|
|
|
991
989
|
:returns: The stac configuration
|
|
992
990
|
"""
|
|
993
|
-
return load_yml_config(
|
|
994
|
-
resource_filename("eodag", os.path.join("resources/", "stac.yml"))
|
|
995
|
-
)
|
|
991
|
+
return load_yml_config(str(res_files("eodag") / "resources" / "stac.yml"))
|
|
996
992
|
|
|
997
993
|
|
|
998
|
-
def load_stac_api_config() ->
|
|
994
|
+
def load_stac_api_config() -> dict[str, Any]:
|
|
999
995
|
"""Load the stac API configuration into a dictionary
|
|
1000
996
|
|
|
1001
997
|
:returns: The stac API configuration
|
|
1002
998
|
"""
|
|
1003
|
-
return load_yml_config(
|
|
1004
|
-
resource_filename("eodag", os.path.join("resources/", "stac_api.yml"))
|
|
1005
|
-
)
|
|
999
|
+
return load_yml_config(str(res_files("eodag") / "resources" / "stac_api.yml"))
|
|
1006
1000
|
|
|
1007
1001
|
|
|
1008
|
-
def load_stac_provider_config() ->
|
|
1002
|
+
def load_stac_provider_config() -> dict[str, Any]:
|
|
1009
1003
|
"""Load the stac provider configuration into a dictionary
|
|
1010
1004
|
|
|
1011
1005
|
:returns: The stac provider configuration
|
|
1012
1006
|
"""
|
|
1013
1007
|
return SimpleYamlProxyConfig(
|
|
1014
|
-
|
|
1008
|
+
str(res_files("eodag") / "resources" / "stac_provider.yml")
|
|
1015
1009
|
).source
|
|
1016
1010
|
|
|
1017
1011
|
|
|
1018
1012
|
def get_ext_product_types_conf(
|
|
1019
1013
|
conf_uri: str = EXT_PRODUCT_TYPES_CONF_URI,
|
|
1020
|
-
) ->
|
|
1014
|
+
) -> dict[str, Any]:
|
|
1021
1015
|
"""Read external product types conf
|
|
1022
1016
|
|
|
1023
1017
|
:param conf_uri: URI to local or remote configuration file
|
eodag/plugins/apis/base.py
CHANGED