eodag 3.0.0b2__py3-none-any.whl → 3.0.1__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/__init__.py +6 -8
- eodag/api/core.py +295 -287
- eodag/api/product/__init__.py +10 -4
- eodag/api/product/_assets.py +2 -14
- eodag/api/product/_product.py +16 -30
- eodag/api/product/drivers/__init__.py +7 -2
- eodag/api/product/drivers/base.py +0 -3
- eodag/api/product/metadata_mapping.py +12 -31
- eodag/api/search_result.py +33 -12
- eodag/cli.py +35 -19
- eodag/config.py +455 -155
- eodag/plugins/apis/base.py +13 -7
- eodag/plugins/apis/ecmwf.py +16 -7
- eodag/plugins/apis/usgs.py +68 -16
- eodag/plugins/authentication/aws_auth.py +25 -7
- eodag/plugins/authentication/base.py +10 -1
- eodag/plugins/authentication/generic.py +14 -3
- eodag/plugins/authentication/header.py +12 -4
- eodag/plugins/authentication/keycloak.py +41 -22
- eodag/plugins/authentication/oauth.py +11 -1
- eodag/plugins/authentication/openid_connect.py +183 -167
- eodag/plugins/authentication/qsauth.py +12 -4
- eodag/plugins/authentication/sas_auth.py +19 -2
- eodag/plugins/authentication/token.py +59 -11
- eodag/plugins/authentication/token_exchange.py +19 -19
- eodag/plugins/crunch/base.py +7 -2
- eodag/plugins/crunch/filter_date.py +8 -11
- eodag/plugins/crunch/filter_latest_intersect.py +5 -7
- eodag/plugins/crunch/filter_latest_tpl_name.py +2 -5
- eodag/plugins/crunch/filter_overlap.py +9 -15
- eodag/plugins/crunch/filter_property.py +9 -14
- eodag/plugins/download/aws.py +84 -99
- eodag/plugins/download/base.py +36 -77
- eodag/plugins/download/creodias_s3.py +11 -2
- eodag/plugins/download/http.py +134 -109
- eodag/plugins/download/s3rest.py +37 -43
- eodag/plugins/manager.py +173 -41
- eodag/plugins/search/__init__.py +9 -9
- eodag/plugins/search/base.py +35 -35
- eodag/plugins/search/build_search_result.py +55 -64
- eodag/plugins/search/cop_marine.py +113 -32
- eodag/plugins/search/creodias_s3.py +20 -8
- eodag/plugins/search/csw.py +41 -1
- eodag/plugins/search/data_request_search.py +119 -14
- eodag/plugins/search/qssearch.py +619 -197
- eodag/plugins/search/static_stac_search.py +25 -23
- eodag/resources/ext_product_types.json +1 -1
- eodag/resources/product_types.yml +211 -56
- eodag/resources/providers.yml +1762 -1809
- eodag/resources/stac.yml +3 -163
- eodag/resources/user_conf_template.yml +134 -119
- eodag/rest/config.py +1 -2
- eodag/rest/constants.py +0 -1
- eodag/rest/core.py +70 -92
- eodag/rest/errors.py +181 -0
- eodag/rest/server.py +24 -330
- eodag/rest/stac.py +105 -630
- eodag/rest/types/eodag_search.py +17 -15
- eodag/rest/types/queryables.py +5 -14
- eodag/rest/types/stac_search.py +18 -13
- eodag/rest/utils/rfc3339.py +0 -1
- eodag/types/__init__.py +24 -6
- eodag/types/download_args.py +14 -5
- eodag/types/queryables.py +1 -2
- eodag/types/search_args.py +10 -11
- eodag/types/whoosh.py +0 -2
- eodag/utils/__init__.py +97 -136
- eodag/utils/constraints.py +0 -8
- eodag/utils/exceptions.py +23 -9
- eodag/utils/import_system.py +0 -4
- eodag/utils/logging.py +37 -80
- eodag/utils/notebook.py +4 -4
- eodag/utils/requests.py +13 -23
- eodag/utils/rest.py +0 -4
- eodag/utils/stac_reader.py +3 -15
- {eodag-3.0.0b2.dist-info → eodag-3.0.1.dist-info}/METADATA +41 -24
- eodag-3.0.1.dist-info/RECORD +109 -0
- {eodag-3.0.0b2.dist-info → eodag-3.0.1.dist-info}/WHEEL +1 -1
- {eodag-3.0.0b2.dist-info → eodag-3.0.1.dist-info}/entry_points.txt +1 -0
- eodag/resources/constraints/climate-dt.json +0 -13
- eodag/resources/constraints/extremes-dt.json +0 -8
- eodag-3.0.0b2.dist-info/RECORD +0 -110
- {eodag-3.0.0b2.dist-info → eodag-3.0.1.dist-info}/LICENSE +0 -0
- {eodag-3.0.0b2.dist-info → eodag-3.0.1.dist-info}/top_level.txt +0 -0
eodag/config.py
CHANGED
|
@@ -22,6 +22,7 @@ import os
|
|
|
22
22
|
import tempfile
|
|
23
23
|
from inspect import isclass
|
|
24
24
|
from typing import (
|
|
25
|
+
Annotated,
|
|
25
26
|
Any,
|
|
26
27
|
Dict,
|
|
27
28
|
ItemsView,
|
|
@@ -44,13 +45,11 @@ import yaml.parser
|
|
|
44
45
|
from annotated_types import Gt
|
|
45
46
|
from jsonpath_ng import JSONPath
|
|
46
47
|
from pkg_resources import resource_filename
|
|
47
|
-
from requests.auth import AuthBase
|
|
48
|
-
from typing_extensions import Doc
|
|
49
48
|
|
|
49
|
+
from eodag.api.product.metadata_mapping import mtd_cfg_as_conversion_and_querypath
|
|
50
50
|
from eodag.utils import (
|
|
51
51
|
HTTP_REQ_TIMEOUT,
|
|
52
52
|
USER_AGENT,
|
|
53
|
-
Annotated,
|
|
54
53
|
cached_yaml_load,
|
|
55
54
|
cached_yaml_load_all,
|
|
56
55
|
cast_scalar_value,
|
|
@@ -58,6 +57,7 @@ from eodag.utils import (
|
|
|
58
57
|
dict_items_recursive_apply,
|
|
59
58
|
merge_mappings,
|
|
60
59
|
slugify,
|
|
60
|
+
sort_dict,
|
|
61
61
|
string_to_jsonpath,
|
|
62
62
|
update_nested_dict,
|
|
63
63
|
uri_to_path,
|
|
@@ -69,6 +69,8 @@ logger = logging.getLogger("eodag.config")
|
|
|
69
69
|
EXT_PRODUCT_TYPES_CONF_URI = (
|
|
70
70
|
"https://cs-si.github.io/eodag/eodag/resources/ext_product_types.json"
|
|
71
71
|
)
|
|
72
|
+
AUTH_TOPIC_KEYS = ("auth", "search_auth", "download_auth")
|
|
73
|
+
PLUGINS_TOPICS_KEYS = ("api", "search", "download") + AUTH_TOPIC_KEYS
|
|
72
74
|
|
|
73
75
|
|
|
74
76
|
class SimpleYamlProxyConfig:
|
|
@@ -110,22 +112,16 @@ class ProviderConfig(yaml.YAMLObject):
|
|
|
110
112
|
"""Representation of eodag configuration.
|
|
111
113
|
|
|
112
114
|
:param name: The name of the provider
|
|
113
|
-
:type name: str
|
|
114
115
|
:param priority: (optional) The priority of the provider while searching a product.
|
|
115
116
|
Lower value means lower priority. (Default: 0)
|
|
116
|
-
:type priority: int
|
|
117
117
|
:param api: (optional) The configuration of a plugin of type Api
|
|
118
|
-
:type api: :class:`~eodag.config.PluginConfig`
|
|
119
118
|
:param search: (optional) The configuration of a plugin of type Search
|
|
120
|
-
:type search: :class:`~eodag.config.PluginConfig`
|
|
121
119
|
:param products: (optional) The products types supported by the provider
|
|
122
|
-
:type products: dict
|
|
123
120
|
:param download: (optional) The configuration of a plugin of type Download
|
|
124
|
-
:type download: :class:`~eodag.config.PluginConfig`
|
|
125
121
|
:param auth: (optional) The configuration of a plugin of type Authentication
|
|
126
|
-
:
|
|
122
|
+
:param search_auth: (optional) The configuration of a plugin of type Authentication for search
|
|
123
|
+
:param download_auth: (optional) The configuration of a plugin of type Authentication for download
|
|
127
124
|
:param kwargs: Additional configuration variables for this provider
|
|
128
|
-
:type kwargs: Any
|
|
129
125
|
"""
|
|
130
126
|
|
|
131
127
|
name: str
|
|
@@ -139,6 +135,8 @@ class ProviderConfig(yaml.YAMLObject):
|
|
|
139
135
|
products: Dict[str, Any]
|
|
140
136
|
download: PluginConfig
|
|
141
137
|
auth: PluginConfig
|
|
138
|
+
search_auth: PluginConfig
|
|
139
|
+
download_auth: PluginConfig
|
|
142
140
|
product_types_fetched: bool # set in core.update_product_types_list
|
|
143
141
|
|
|
144
142
|
yaml_loader = yaml.Loader
|
|
@@ -159,7 +157,7 @@ class ProviderConfig(yaml.YAMLObject):
|
|
|
159
157
|
def from_mapping(cls, mapping: Dict[str, Any]) -> ProviderConfig:
|
|
160
158
|
"""Build a :class:`~eodag.config.ProviderConfig` from a mapping"""
|
|
161
159
|
cls.validate(mapping)
|
|
162
|
-
for key in
|
|
160
|
+
for key in PLUGINS_TOPICS_KEYS:
|
|
163
161
|
if key in mapping:
|
|
164
162
|
mapping[key] = PluginConfig.from_mapping(mapping[key])
|
|
165
163
|
c = cls()
|
|
@@ -171,15 +169,13 @@ class ProviderConfig(yaml.YAMLObject):
|
|
|
171
169
|
"""Validate a :class:`~eodag.config.ProviderConfig`
|
|
172
170
|
|
|
173
171
|
:param config_keys: The configurations keys to validate
|
|
174
|
-
:type config_keys: dict
|
|
175
172
|
"""
|
|
176
173
|
if "name" not in config_keys:
|
|
177
174
|
raise ValidationError("Provider config must have name key")
|
|
178
|
-
if not any(k in config_keys for k in
|
|
175
|
+
if not any(k in config_keys for k in PLUGINS_TOPICS_KEYS):
|
|
179
176
|
raise ValidationError("A provider must implement at least one plugin")
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
):
|
|
177
|
+
non_api_keys = [k for k in PLUGINS_TOPICS_KEYS if k != "api"]
|
|
178
|
+
if "api" in config_keys and any(k in config_keys for k in non_api_keys):
|
|
183
179
|
raise ValidationError(
|
|
184
180
|
"A provider implementing an Api plugin must not implement any other "
|
|
185
181
|
"type of plugin"
|
|
@@ -189,7 +185,6 @@ class ProviderConfig(yaml.YAMLObject):
|
|
|
189
185
|
"""Update the configuration parameters with values from `mapping`
|
|
190
186
|
|
|
191
187
|
:param mapping: The mapping from which to override configuration parameters
|
|
192
|
-
:type mapping: dict
|
|
193
188
|
"""
|
|
194
189
|
if mapping is None:
|
|
195
190
|
mapping = {}
|
|
@@ -198,11 +193,10 @@ class ProviderConfig(yaml.YAMLObject):
|
|
|
198
193
|
{
|
|
199
194
|
key: value
|
|
200
195
|
for key, value in mapping.items()
|
|
201
|
-
if key not in
|
|
202
|
-
and value is not None
|
|
196
|
+
if key not in PLUGINS_TOPICS_KEYS and value is not None
|
|
203
197
|
},
|
|
204
198
|
)
|
|
205
|
-
for key in
|
|
199
|
+
for key in PLUGINS_TOPICS_KEYS:
|
|
206
200
|
current_value: Optional[Dict[str, Any]] = getattr(self, key, None)
|
|
207
201
|
mapping_value = mapping.get(key, {})
|
|
208
202
|
if current_value is not None:
|
|
@@ -212,43 +206,112 @@ class ProviderConfig(yaml.YAMLObject):
|
|
|
212
206
|
|
|
213
207
|
|
|
214
208
|
class PluginConfig(yaml.YAMLObject):
|
|
215
|
-
"""Representation of a plugin config
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
:type name: str
|
|
219
|
-
:param metadata_mapping: (optional) The mapping between eodag metadata and
|
|
220
|
-
the plugin specific metadata
|
|
221
|
-
:type metadata_mapping: dict
|
|
222
|
-
:param free_params: (optional) Additional configuration parameters
|
|
223
|
-
:type free_params: dict
|
|
209
|
+
"""Representation of a plugin config.
|
|
210
|
+
|
|
211
|
+
This class variables describe available plugins configuration parameters.
|
|
224
212
|
"""
|
|
225
213
|
|
|
226
214
|
class Pagination(TypedDict):
|
|
227
215
|
"""Search pagination configuration"""
|
|
228
216
|
|
|
217
|
+
#: The maximum number of items per page that the provider can handle
|
|
229
218
|
max_items_per_page: int
|
|
219
|
+
#: Key path for the number of total items in the provider result
|
|
230
220
|
total_items_nb_key_path: Union[str, JSONPath]
|
|
221
|
+
#: Key path for the next page URL
|
|
231
222
|
next_page_url_key_path: Union[str, JSONPath]
|
|
223
|
+
#: Key path for the next page POST request query-object (body)
|
|
232
224
|
next_page_query_obj_key_path: Union[str, JSONPath]
|
|
225
|
+
# TODO: change this typing to bool and adapt code to it
|
|
233
226
|
next_page_merge_key_path: Union[str, JSONPath]
|
|
227
|
+
#: Template to add to :attr:`~eodag.config.PluginConfig.Pagination.next_page_url_tpl` to enable count in
|
|
228
|
+
#: search request
|
|
234
229
|
count_tpl: str
|
|
230
|
+
#: The f-string template for pagination requests.
|
|
235
231
|
next_page_url_tpl: str
|
|
232
|
+
#: The query-object for POST pagination requests.
|
|
236
233
|
next_page_query_obj: str
|
|
234
|
+
#: The endpoint for counting the number of items satisfying a request
|
|
237
235
|
count_endpoint: str
|
|
236
|
+
#: Index of the starting page
|
|
238
237
|
start_page: int
|
|
239
238
|
|
|
240
239
|
class Sort(TypedDict):
|
|
241
240
|
"""Configuration for sort during search"""
|
|
242
241
|
|
|
242
|
+
#: Default sort settings
|
|
243
243
|
sort_by_default: List[Tuple[str, str]]
|
|
244
|
+
#: F-string template to add to :attr:`~eodag.config.PluginConfig.Pagination.next_page_url_tpl` to sort search
|
|
245
|
+
#: results
|
|
244
246
|
sort_by_tpl: str
|
|
247
|
+
#: Mapping between eodag and provider query parameters used for sort
|
|
245
248
|
sort_param_mapping: Dict[str, str]
|
|
249
|
+
#: Mapping between eodag and provider sort-order parameters
|
|
246
250
|
sort_order_mapping: Dict[Literal["ascending", "descending"], str]
|
|
251
|
+
#: Maximum number of allowed sort parameters per request
|
|
247
252
|
max_sort_params: Annotated[int, Gt(0)]
|
|
248
253
|
|
|
254
|
+
class DiscoverMetadata(TypedDict):
|
|
255
|
+
"""Configuration for metadata discovery (search result properties)"""
|
|
256
|
+
|
|
257
|
+
#: Whether metadata discovery is enabled or not
|
|
258
|
+
auto_discovery: bool
|
|
259
|
+
#: Metadata regex pattern used for discovery in search result properties
|
|
260
|
+
metadata_pattern: str
|
|
261
|
+
#: Configuration/template that will be used to query for a discovered parameter
|
|
262
|
+
search_param: str
|
|
263
|
+
#: Path to the metadata in search result
|
|
264
|
+
metadata_path: str
|
|
265
|
+
|
|
266
|
+
class DiscoverProductTypes(TypedDict, total=False):
|
|
267
|
+
"""Configuration for product types discovery"""
|
|
268
|
+
|
|
269
|
+
#: URL from which the product types can be fetched
|
|
270
|
+
fetch_url: Optional[str]
|
|
271
|
+
#: HTTP method used to fetch product types
|
|
272
|
+
fetch_method: str
|
|
273
|
+
#: Request body to fetch product types using POST method
|
|
274
|
+
fetch_body: Dict[str, Any]
|
|
275
|
+
#: Maximum number of connections for concurrent HTTP requests
|
|
276
|
+
max_connections: int
|
|
277
|
+
#: The f-string template for pagination requests.
|
|
278
|
+
next_page_url_tpl: str
|
|
279
|
+
#: Index of the starting page for pagination requests.
|
|
280
|
+
start_page: int
|
|
281
|
+
#: Type of the provider result
|
|
282
|
+
result_type: str
|
|
283
|
+
#: JsonPath to the list of product types
|
|
284
|
+
results_entry: Union[JSONPath, str]
|
|
285
|
+
#: Mapping for the product type id
|
|
286
|
+
generic_product_type_id: str
|
|
287
|
+
#: Mapping for product type metadata (e.g. ``abstract``, ``licence``) which can be parsed from the provider
|
|
288
|
+
#: result
|
|
289
|
+
generic_product_type_parsable_metadata: Dict[str, str]
|
|
290
|
+
#: Mapping for product type properties which can be parsed from the result that are not product type metadata
|
|
291
|
+
generic_product_type_parsable_properties: Dict[str, str]
|
|
292
|
+
#: URL to fetch data for a single collection
|
|
293
|
+
single_collection_fetch_url: str
|
|
294
|
+
#: Query string to be added to the fetch_url to filter for a collection
|
|
295
|
+
single_collection_fetch_qs: str
|
|
296
|
+
#: Mapping for product type metadata returned by the endpoint given in single_collection_fetch_url
|
|
297
|
+
single_product_type_parsable_metadata: Dict[str, str]
|
|
298
|
+
|
|
299
|
+
class DiscoverQueryables(TypedDict, total=False):
|
|
300
|
+
"""Configuration for queryables discovery"""
|
|
301
|
+
|
|
302
|
+
#: URL to fetch the queryables valid for all product types
|
|
303
|
+
fetch_url: Optional[str]
|
|
304
|
+
#: URL to fetch the queryables for a specific product type
|
|
305
|
+
product_type_fetch_url: Optional[str]
|
|
306
|
+
#: Type of the result
|
|
307
|
+
result_type: str
|
|
308
|
+
#: JsonPath to retrieve the queryables from the provider result
|
|
309
|
+
results_entry: str
|
|
310
|
+
|
|
249
311
|
class OrderOnResponse(TypedDict):
|
|
250
312
|
"""Configuration for order on-response during download"""
|
|
251
313
|
|
|
314
|
+
#: Parameters metadata-mapping to apply to the order response
|
|
252
315
|
metadata_mapping: Dict[str, Union[str, List[str]]]
|
|
253
316
|
|
|
254
317
|
class OrderStatusSuccess(TypedDict):
|
|
@@ -259,136 +322,312 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
259
322
|
At least one is required
|
|
260
323
|
"""
|
|
261
324
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
325
|
+
#: Success value for ``status``
|
|
326
|
+
status: str
|
|
327
|
+
#: Success value for ``message``
|
|
328
|
+
message: str
|
|
329
|
+
#: Success value for status response HTTP code
|
|
330
|
+
http_code: int
|
|
265
331
|
|
|
266
|
-
class OrderStatusOrdered(TypedDict):
|
|
332
|
+
class OrderStatusOrdered(TypedDict, total=False):
|
|
267
333
|
"""
|
|
268
334
|
Configuration to identify order status ordered during download
|
|
269
335
|
"""
|
|
270
336
|
|
|
271
|
-
|
|
337
|
+
#: HTTP code of the order status response
|
|
338
|
+
http_code: int
|
|
272
339
|
|
|
273
|
-
class OrderStatusRequest(TypedDict):
|
|
340
|
+
class OrderStatusRequest(TypedDict, total=False):
|
|
274
341
|
"""
|
|
275
342
|
Order status request configuration
|
|
276
343
|
"""
|
|
277
344
|
|
|
278
|
-
|
|
279
|
-
|
|
345
|
+
#: Request HTTP method
|
|
346
|
+
method: str
|
|
347
|
+
#: Request hearders
|
|
348
|
+
headers: Dict[str, Any]
|
|
280
349
|
|
|
281
|
-
class OrderStatusOnSuccess(TypedDict):
|
|
350
|
+
class OrderStatusOnSuccess(TypedDict, total=False):
|
|
282
351
|
"""Configuration for order status on-success during download"""
|
|
283
352
|
|
|
284
|
-
|
|
353
|
+
#: Whether a new search is needed on success or not
|
|
354
|
+
need_search: bool
|
|
355
|
+
#: Return type of the success result
|
|
285
356
|
result_type: str
|
|
357
|
+
#: Key in the success response that gives access to the result
|
|
286
358
|
results_entry: str
|
|
359
|
+
#: Metadata-mapping to apply to the success status result
|
|
287
360
|
metadata_mapping: Dict[str, Union[str, List[str]]]
|
|
288
361
|
|
|
289
|
-
class OrderStatus(TypedDict):
|
|
362
|
+
class OrderStatus(TypedDict, total=False):
|
|
290
363
|
"""Configuration for order status during download"""
|
|
291
364
|
|
|
365
|
+
#: Order status request configuration
|
|
292
366
|
request: PluginConfig.OrderStatusRequest
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
]
|
|
367
|
+
#: Metadata-mapping used to parse order status response
|
|
368
|
+
metadata_mapping: Dict[str, Union[str, List[str]]]
|
|
369
|
+
#: Configuration to identify order status success during download
|
|
297
370
|
success: PluginConfig.OrderStatusSuccess
|
|
298
|
-
error
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
]
|
|
371
|
+
#: Part of the order status response that tells there is an error
|
|
372
|
+
error: Dict[str, Any]
|
|
373
|
+
#: Configuration to identify order status ordered during download
|
|
302
374
|
ordered: PluginConfig.OrderStatusOrdered
|
|
375
|
+
#: Configuration for order status on-success during download
|
|
303
376
|
on_success: PluginConfig.OrderStatusOnSuccess
|
|
304
377
|
|
|
378
|
+
class MetadataPreMapping(TypedDict, total=False):
|
|
379
|
+
"""Configuration which can be used to simplify further metadata extraction"""
|
|
380
|
+
|
|
381
|
+
#: JsonPath of the metadata entry
|
|
382
|
+
metadata_path: str
|
|
383
|
+
#: Key to get the metadata id
|
|
384
|
+
metadata_path_id: str
|
|
385
|
+
#: Key to get the metadata value
|
|
386
|
+
metadata_path_value: str
|
|
387
|
+
|
|
388
|
+
#: :class:`~eodag.plugins.base.PluginTopic` The name of the plugin class to use to instantiate the plugin object
|
|
305
389
|
name: str
|
|
390
|
+
#: :class:`~eodag.plugins.base.PluginTopic` Plugin type
|
|
306
391
|
type: str
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
392
|
+
#: :class:`~eodag.plugins.base.PluginTopic` Whether the ssl certificates should be verified in the request or not
|
|
393
|
+
ssl_verify: bool
|
|
394
|
+
#: :class:`~eodag.plugins.base.PluginTopic` Default s3 bucket
|
|
395
|
+
s3_bucket: str
|
|
396
|
+
#: :class:`~eodag.plugins.base.PluginTopic` Authentication error codes
|
|
397
|
+
auth_error_code: Union[int, List[int]]
|
|
398
|
+
#: :class:`~eodag.plugins.base.PluginTopic` Time to wait until request timeout in seconds
|
|
399
|
+
timeout: float
|
|
400
|
+
#: :class:`~eodag.plugins.base.PluginTopic` :class:`urllib3.util.Retry` ``total`` parameter,
|
|
401
|
+
#: total number of retries to allow
|
|
402
|
+
retry_total: int
|
|
403
|
+
#: :class:`~eodag.plugins.base.PluginTopic` :class:`urllib3.util.Retry` ``backoff_factor`` parameter,
|
|
404
|
+
#: backoff factor to apply between attempts after the second try
|
|
405
|
+
retry_backoff_factor: int
|
|
406
|
+
#: :class:`~eodag.plugins.base.PluginTopic` :class:`urllib3.util.Retry` ``status_forcelist`` parameter,
|
|
407
|
+
#: list of integer HTTP status codes that we should force a retry on
|
|
408
|
+
retry_status_forcelist: List[int]
|
|
409
|
+
|
|
410
|
+
# search & api -----------------------------------------------------------------------------------------------------
|
|
411
|
+
# copied from ProviderConfig in PluginManager.get_search_plugins()
|
|
412
|
+
priority: int
|
|
413
|
+
# per product type metadata-mapping, set in core._prepare_search
|
|
414
|
+
product_type_config: Dict[str, Any]
|
|
415
|
+
|
|
416
|
+
#: :class:`~eodag.plugins.search.base.Search` Plugin API endpoint
|
|
315
417
|
api_endpoint: str
|
|
418
|
+
#: :class:`~eodag.plugins.search.base.Search` Whether Search plugin needs authentification or not
|
|
316
419
|
need_auth: bool
|
|
420
|
+
#: :class:`~eodag.plugins.search.base.Search` Return type of the provider result
|
|
317
421
|
result_type: str
|
|
422
|
+
#: :class:`~eodag.plugins.search.base.Search`
|
|
423
|
+
#: Key in the provider search result that gives access to the result entries
|
|
318
424
|
results_entry: str
|
|
425
|
+
#: :class:`~eodag.plugins.search.base.Search` Dict containing parameters for pagination
|
|
319
426
|
pagination: PluginConfig.Pagination
|
|
427
|
+
#: :class:`~eodag.plugins.search.base.Search` Configuration for sorting the results
|
|
320
428
|
sort: PluginConfig.Sort
|
|
321
|
-
|
|
322
|
-
discover_metadata:
|
|
323
|
-
|
|
324
|
-
|
|
429
|
+
#: :class:`~eodag.plugins.search.base.Search` Configuration for the metadata auto-discovery
|
|
430
|
+
discover_metadata: PluginConfig.DiscoverMetadata
|
|
431
|
+
#: :class:`~eodag.plugins.search.base.Search` Configuration for the product types auto-discovery
|
|
432
|
+
discover_product_types: PluginConfig.DiscoverProductTypes
|
|
433
|
+
#: :class:`~eodag.plugins.search.base.Search` Configuration for the queryables auto-discovery
|
|
434
|
+
discover_queryables: PluginConfig.DiscoverQueryables
|
|
435
|
+
#: :class:`~eodag.plugins.search.base.Search` The mapping between eodag metadata and the plugin specific metadata
|
|
325
436
|
metadata_mapping: Dict[str, Union[str, List[str]]]
|
|
326
|
-
|
|
437
|
+
#: :class:`~eodag.plugins.search.base.Search` URL of the constraint file used to build queryables
|
|
327
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
|
|
448
|
+
#: :class:`~eodag.plugins.search.base.Search` Parameters to remove from queryables
|
|
328
449
|
remove_from_queryables: List[str]
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
450
|
+
#: :class:`~eodag.plugins.search.base.Search` Parameters to be passed as is in the search url query string
|
|
451
|
+
literal_search_params: Dict[str, str]
|
|
452
|
+
#: :class:`~eodag.plugins.search.qssearch.QueryStringSearch` Characters that should not be quoted in the url params
|
|
453
|
+
dont_quote: List[str]
|
|
454
|
+
#: :class:`~eodag.plugins.search.qssearch.ODataV4Search` Dict describing free text search request build
|
|
455
|
+
free_text_search_operations: Dict[str, Any]
|
|
456
|
+
#: :class:`~eodag.plugins.search.qssearch.ODataV4Search` Set to ``True`` if the metadata is not given in the search
|
|
457
|
+
#: result and a two step search has to be performed
|
|
458
|
+
per_product_metadata_query: bool
|
|
459
|
+
#: :class:`~eodag.plugins.search.qssearch.ODataV4Search` Dict used to simplify further metadata extraction
|
|
460
|
+
metadata_pre_mapping: PluginConfig.MetadataPreMapping
|
|
461
|
+
#: :class:`~eodag.plugins.search.data_request_search.DataRequestSearch` URL to which the data request shall be sent
|
|
462
|
+
data_request_url: str
|
|
463
|
+
#: :class:`~eodag.plugins.search.data_request_search.DataRequestSearch` URL to fetch the status of the data request
|
|
464
|
+
status_url: str
|
|
465
|
+
#: :class:`~eodag.plugins.search.data_request_search.DataRequestSearch`
|
|
466
|
+
#: URL to fetch the search result when the data request is done
|
|
467
|
+
result_url: str
|
|
468
|
+
#: :class:`~eodag.plugins.search.data_request_search.DataRequestSearch`
|
|
469
|
+
#: if date parameters are mandatory in the request
|
|
470
|
+
dates_required: bool
|
|
471
|
+
#: :class:`~eodag.plugins.search.csw.CSWSearch` Search definition dictionary
|
|
472
|
+
search_definition: Dict[str, Any]
|
|
473
|
+
#: :class:`~eodag.plugins.search.qssearch.PostJsonSearch` Whether to merge responses or not (`aws_eos` specific)
|
|
474
|
+
merge_responses: bool
|
|
475
|
+
#: :class:`~eodag.plugins.search.qssearch.PostJsonSearch` Collections names (`aws_eos` specific)
|
|
476
|
+
collection: List[str]
|
|
477
|
+
#: :class:`~eodag.plugins.search.static_stac_search.StaticStacSearch`
|
|
478
|
+
#: Maximum number of connections for concurrent HTTP requests
|
|
479
|
+
max_connections: int
|
|
480
|
+
#: :class:`~eodag.plugins.search.build_search_result.BuildSearchResult`
|
|
481
|
+
#: Whether end date should be excluded from search request or not
|
|
482
|
+
end_date_excluded: bool
|
|
483
|
+
#: :class:`~eodag.plugins.search.build_search_result.BuildSearchResult`
|
|
484
|
+
#: List of parameters used to parse metadata but that must not be included to the query
|
|
485
|
+
remove_from_query: List[str]
|
|
486
|
+
#: :class:`~eodag.plugins.search.csw.CSWSearch`
|
|
487
|
+
#: OGC Catalogue Service version
|
|
488
|
+
version: str
|
|
489
|
+
|
|
490
|
+
# download ---------------------------------------------------------------------------------------------------------
|
|
491
|
+
#: :class:`~eodag.plugins.download.base.Download` Default endpoint url
|
|
345
492
|
base_uri: str
|
|
346
|
-
|
|
493
|
+
#: :class:`~eodag.plugins.download.base.Download` Where to store downloaded products, as an absolute file path
|
|
494
|
+
output_dir: str
|
|
495
|
+
#: :class:`~eodag.plugins.download.base.Download`
|
|
496
|
+
#: Whether the content of the downloaded file should be extracted or not
|
|
347
497
|
extract: bool
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
498
|
+
#: :class:`~eodag.plugins.download.base.Download` Which extension should be used for the downloaded file
|
|
499
|
+
output_extension: str
|
|
500
|
+
#: :class:`~eodag.plugins.download.base.Download` Whether the directory structure should be flattened or not
|
|
501
|
+
flatten_top_dirs: bool
|
|
502
|
+
#: :class:`~eodag.plugins.download.base.Download` Level in extracted path tree where to find data
|
|
503
|
+
archive_depth: int
|
|
504
|
+
#: :class:`~eodag.plugins.download.base.Download` Whether ignore assets and download using ``downloadLink`` or not
|
|
505
|
+
ignore_assets: bool
|
|
506
|
+
#: :class:`~eodag.plugins.download.base.Download` Product type specific configuration
|
|
507
|
+
products: Dict[str, Dict[str, Any]]
|
|
508
|
+
#: :class:`~eodag.plugins.download.http.HTTPDownload` Whether the product has to be ordered to download it or not
|
|
509
|
+
order_enabled: bool
|
|
510
|
+
#: :class:`~eodag.plugins.download.http.HTTPDownload` HTTP request method for the order request
|
|
511
|
+
order_method: str
|
|
512
|
+
#: :class:`~eodag.plugins.download.http.HTTPDownload` Headers to be added to the order request
|
|
513
|
+
order_headers: Dict[str, str]
|
|
514
|
+
#: :class:`~eodag.plugins.download.http.HTTPDownload`
|
|
515
|
+
#: Dictionary containing the key :attr:`~eodag.config.PluginConfig.metadata_mapping` which can be used to add new
|
|
516
|
+
#: product properties based on the data in response to the order request
|
|
353
517
|
order_on_response: PluginConfig.OrderOnResponse
|
|
518
|
+
#: :class:`~eodag.plugins.download.http.HTTPDownload` Order status handling
|
|
354
519
|
order_status: PluginConfig.OrderStatus
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
520
|
+
#: :class:`~eodag.plugins.download.http.HTTPDownload`
|
|
521
|
+
#: Do not authenticate the download request but only the order and order status ones
|
|
522
|
+
no_auth_download: bool
|
|
523
|
+
#: :class:`~eodag.plugins.download.http.HTTPDownload` Parameters to be added to the query params of the request
|
|
524
|
+
dl_url_params: Dict[str, str]
|
|
525
|
+
#: :class:`~eodag.plugins.download.s3rest.S3RestDownload`
|
|
526
|
+
#: At which level of the path part of the url the bucket can be found
|
|
527
|
+
bucket_path_level: int
|
|
528
|
+
#: :class:`~eodag.plugins.download.aws.AwsDownload` Whether download is done from a requester-pays bucket or not
|
|
529
|
+
requester_pays: bool
|
|
530
|
+
#: :class:`~eodag.plugins.download.aws.AwsDownload` S3 endpoint
|
|
531
|
+
s3_endpoint: str
|
|
532
|
+
|
|
533
|
+
# auth -------------------------------------------------------------------------------------------------------------
|
|
534
|
+
#: :class:`~eodag.plugins.authentication.base.Authentication` Authentication credentials dictionary
|
|
366
535
|
credentials: Dict[str, str]
|
|
536
|
+
#: :class:`~eodag.plugins.authentication.base.Authentication` Authentication URL
|
|
367
537
|
auth_uri: str
|
|
368
|
-
|
|
369
|
-
|
|
538
|
+
#: :class:`~eodag.plugins.authentication.base.Authentication`
|
|
539
|
+
#: Dictionary containing all keys/value pairs that should be added to the headers
|
|
370
540
|
headers: Dict[str, str]
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
541
|
+
#: :class:`~eodag.plugins.authentication.base.Authentication`
|
|
542
|
+
#: The key pointing to the token in the response from the token server
|
|
543
|
+
token_key: str
|
|
544
|
+
#: :class:`~eodag.plugins.authentication.base.Authentication`
|
|
545
|
+
#: Key to get the refresh token in the response from the token server
|
|
546
|
+
refresh_token_key: str
|
|
547
|
+
#: :class:`~eodag.plugins.authentication.base.Authentication` URL pattern to match with search plugin endpoint or
|
|
548
|
+
#: download link
|
|
549
|
+
matching_url: str
|
|
550
|
+
#: :class:`~eodag.plugins.authentication.base.Authentication` Part of the search or download plugin configuration
|
|
551
|
+
#: that needs authentication
|
|
552
|
+
matching_conf: Dict[str, Any]
|
|
553
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCRefreshTokenBase`
|
|
554
|
+
#: How the token should be used in the request
|
|
555
|
+
token_provision: str
|
|
556
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCRefreshTokenBase` The OIDC provider's client ID
|
|
557
|
+
client_id: str
|
|
558
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCRefreshTokenBase` The OIDC provider's client secret
|
|
559
|
+
client_secret: str
|
|
560
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCRefreshTokenBase`
|
|
561
|
+
#: The OIDC provider's ``.well-known/openid-configuration`` url.
|
|
562
|
+
oidc_config_url: str
|
|
563
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCRefreshTokenBase` The OIDC token audiences
|
|
564
|
+
allowed_audiences: List[str]
|
|
565
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
566
|
+
#: Whether a user consent is needed during the authentication or not
|
|
567
|
+
user_consent_needed: str
|
|
568
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
569
|
+
#: Where to look for the :attr:`~eodag.config.PluginConfig.authorization_uri`
|
|
570
|
+
authentication_uri_source: str
|
|
571
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
572
|
+
#: The callback url that will handle the code given by the OIDC provider
|
|
573
|
+
authentication_uri: str
|
|
574
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
575
|
+
#: The URL of the authentication backend of the OIDC provider
|
|
576
|
+
redirect_uri: str
|
|
577
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
578
|
+
#: The authorization url of the server (where to query for grants)
|
|
579
|
+
authorization_uri: str
|
|
580
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
581
|
+
#: The xpath to the HTML form element representing the user login form
|
|
582
|
+
login_form_xpath: str
|
|
583
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
584
|
+
#: The xpath to the user consent form
|
|
585
|
+
user_consent_form_xpath: str
|
|
586
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
587
|
+
#: The data that will be passed with the POST request on the form 'action' URL
|
|
588
|
+
user_consent_form_data: Dict[str, str]
|
|
589
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
590
|
+
#: Additional data to be passed to the login POST request
|
|
591
|
+
additional_login_form_data: Dict[str, str]
|
|
592
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
593
|
+
#: Key/value pairs of patterns/messages used for Authentication errors
|
|
594
|
+
exchange_url_error_pattern: Dict[str, str]
|
|
595
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
596
|
+
#: A mapping between OIDC url query string and token handler query string params
|
|
597
|
+
token_exchange_params: Dict[str, str]
|
|
598
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
599
|
+
#: Refers to the name of the query param to be used in the query request
|
|
600
|
+
token_qs_key: str
|
|
601
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
602
|
+
#: Way to pass the data to the POST request that is made to the token server
|
|
603
|
+
token_exchange_post_data_method: str
|
|
604
|
+
#: :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth`
|
|
605
|
+
#: The url to query to get the authorized token
|
|
606
|
+
token_uri: str
|
|
607
|
+
#: :class:`~eodag.plugins.authentication.sas_auth.SASAuth` Key to get the signed url
|
|
608
|
+
signed_url_key: str
|
|
609
|
+
#: :class:`~eodag.plugins.authentication.token.TokenAuth`
|
|
610
|
+
#: Credentials json structure if they should be sent as POST data
|
|
611
|
+
req_data: Dict[str, Any]
|
|
612
|
+
#: :class:`~eodag.plugins.authentication.token.TokenAuth`
|
|
613
|
+
#: URL used to fetch the access token with a refresh token
|
|
614
|
+
refresh_uri: str
|
|
615
|
+
#: :class:`~eodag.plugins.authentication.token.TokenAuth`
|
|
616
|
+
#: type of the token
|
|
617
|
+
token_type: str
|
|
618
|
+
#: :class:`~eodag.plugins.authentication.token_exchange.OIDCTokenExchangeAuth`
|
|
619
|
+
#: The full :class:`~eodag.plugins.authentication.openid_connect.OIDCAuthorizationCodeFlowAuth` plugin configuration
|
|
620
|
+
#: used to retrieve subject token
|
|
621
|
+
subject: Dict[str, Any]
|
|
622
|
+
#: :class:`~eodag.plugins.authentication.token_exchange.OIDCTokenExchangeAuth`
|
|
623
|
+
#: Identifies the issuer of the `subject_token`
|
|
624
|
+
subject_issuer: str
|
|
625
|
+
#: :class:`~eodag.plugins.authentication.token_exchange.OIDCTokenExchangeAuth`
|
|
626
|
+
#: Audience that the token ID is intended for. :attr:`~eodag.config.PluginConfig.client_id` of the Relying Party
|
|
627
|
+
audience: str
|
|
628
|
+
#: :class:`~eodag.plugins.authentication.generic.GenericAuth`
|
|
629
|
+
#: which authentication method should be used
|
|
630
|
+
method: str
|
|
392
631
|
|
|
393
632
|
yaml_loader = yaml.Loader
|
|
394
633
|
yaml_dumper = yaml.SafeDumper
|
|
@@ -419,7 +658,6 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
419
658
|
"""Update the configuration parameters with values from `mapping`
|
|
420
659
|
|
|
421
660
|
:param mapping: The mapping from which to override configuration parameters
|
|
422
|
-
:type mapping: dict
|
|
423
661
|
"""
|
|
424
662
|
if mapping is None:
|
|
425
663
|
mapping = {}
|
|
@@ -429,13 +667,12 @@ class PluginConfig(yaml.YAMLObject):
|
|
|
429
667
|
|
|
430
668
|
|
|
431
669
|
def load_default_config() -> Dict[str, ProviderConfig]:
|
|
432
|
-
"""Load the providers configuration into a
|
|
670
|
+
"""Load the providers configuration into a dictionary.
|
|
433
671
|
|
|
434
672
|
Load from eodag `resources/providers.yml` or `EODAG_PROVIDERS_CFG_FILE` environment
|
|
435
673
|
variable if exists.
|
|
436
674
|
|
|
437
675
|
:returns: The default provider's configuration
|
|
438
|
-
:rtype: dict
|
|
439
676
|
"""
|
|
440
677
|
eodag_providers_cfg_file = os.getenv(
|
|
441
678
|
"EODAG_PROVIDERS_CFG_FILE"
|
|
@@ -444,12 +681,10 @@ def load_default_config() -> Dict[str, ProviderConfig]:
|
|
|
444
681
|
|
|
445
682
|
|
|
446
683
|
def load_config(config_path: str) -> Dict[str, ProviderConfig]:
|
|
447
|
-
"""Load the providers configuration into a
|
|
684
|
+
"""Load the providers configuration into a dictionary from a given file
|
|
448
685
|
|
|
449
686
|
:param config_path: The path to the provider config file
|
|
450
|
-
:type config_path: str
|
|
451
687
|
:returns: The default provider's configuration
|
|
452
|
-
:rtype: dict
|
|
453
688
|
"""
|
|
454
689
|
logger.debug("Loading configuration from %s", config_path)
|
|
455
690
|
config: Dict[str, ProviderConfig] = {}
|
|
@@ -462,12 +697,65 @@ def load_config(config_path: str) -> Dict[str, ProviderConfig]:
|
|
|
462
697
|
raise e
|
|
463
698
|
stac_provider_config = load_stac_provider_config()
|
|
464
699
|
for provider_config in providers_configs:
|
|
465
|
-
# for provider_config in copy.deepcopy(providers_configs):
|
|
466
700
|
provider_config_init(provider_config, stac_provider_config)
|
|
467
701
|
config[provider_config.name] = provider_config
|
|
468
702
|
return config
|
|
469
703
|
|
|
470
704
|
|
|
705
|
+
def credentials_in_auth(auth_conf: PluginConfig) -> bool:
|
|
706
|
+
"""Checks if credentials are set for this Authentication plugin configuration
|
|
707
|
+
|
|
708
|
+
:param auth_conf: Authentication plugin configuration
|
|
709
|
+
:returns: True if credentials are set, else False
|
|
710
|
+
"""
|
|
711
|
+
return any(
|
|
712
|
+
c is not None for c in (getattr(auth_conf, "credentials", {}) or {}).values()
|
|
713
|
+
)
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
def share_credentials(
|
|
717
|
+
providers_config: Dict[str, ProviderConfig],
|
|
718
|
+
) -> None:
|
|
719
|
+
"""Share credentials between plugins having the same matching criteria
|
|
720
|
+
|
|
721
|
+
:param providers_configs: eodag providers configurations
|
|
722
|
+
"""
|
|
723
|
+
auth_confs_with_creds = [
|
|
724
|
+
getattr(p, k)
|
|
725
|
+
for p in providers_config.values()
|
|
726
|
+
for k in AUTH_TOPIC_KEYS
|
|
727
|
+
if hasattr(p, k) and credentials_in_auth(getattr(p, k))
|
|
728
|
+
]
|
|
729
|
+
for provider, provider_config in providers_config.items():
|
|
730
|
+
if auth_confs_with_creds:
|
|
731
|
+
for auth_topic_key in AUTH_TOPIC_KEYS:
|
|
732
|
+
provider_config_auth = getattr(provider_config, auth_topic_key, None)
|
|
733
|
+
if provider_config_auth and not credentials_in_auth(
|
|
734
|
+
provider_config_auth
|
|
735
|
+
):
|
|
736
|
+
# no credentials set for this provider
|
|
737
|
+
provider_matching_conf = getattr(
|
|
738
|
+
provider_config_auth, "matching_conf", {}
|
|
739
|
+
)
|
|
740
|
+
provider_matching_url = getattr(
|
|
741
|
+
provider_config_auth, "matching_url", None
|
|
742
|
+
)
|
|
743
|
+
for conf_with_creds in auth_confs_with_creds:
|
|
744
|
+
# copy credentials between plugins if `matching_conf` or `matching_url` are matching
|
|
745
|
+
if (
|
|
746
|
+
provider_matching_conf
|
|
747
|
+
and sort_dict(provider_matching_conf)
|
|
748
|
+
== sort_dict(getattr(conf_with_creds, "matching_conf", {}))
|
|
749
|
+
) or (
|
|
750
|
+
provider_matching_url
|
|
751
|
+
and provider_matching_url
|
|
752
|
+
== getattr(conf_with_creds, "matching_url", None)
|
|
753
|
+
):
|
|
754
|
+
getattr(
|
|
755
|
+
providers_config[provider], auth_topic_key
|
|
756
|
+
).credentials = conf_with_creds.credentials
|
|
757
|
+
|
|
758
|
+
|
|
471
759
|
def provider_config_init(
|
|
472
760
|
provider_config: ProviderConfig,
|
|
473
761
|
stac_search_default_conf: Optional[Dict[str, Any]] = None,
|
|
@@ -475,19 +763,17 @@ def provider_config_init(
|
|
|
475
763
|
"""Applies some default values to provider config
|
|
476
764
|
|
|
477
765
|
:param provider_config: An eodag provider configuration
|
|
478
|
-
:type provider_config: :class:`~eodag.config.ProviderConfig`
|
|
479
766
|
:param stac_search_default_conf: default conf to overwrite with provider_config if STAC
|
|
480
|
-
:type stac_search_default_conf: dict
|
|
481
767
|
"""
|
|
482
|
-
# For the provider, set the default
|
|
768
|
+
# For the provider, set the default output_dir of its download plugin
|
|
483
769
|
# as tempdir in a portable way
|
|
484
|
-
for
|
|
485
|
-
if
|
|
486
|
-
|
|
487
|
-
if not getattr(
|
|
488
|
-
|
|
489
|
-
if not getattr(
|
|
490
|
-
|
|
770
|
+
for download_topic_key in ("download", "api"):
|
|
771
|
+
if download_topic_key in vars(provider_config):
|
|
772
|
+
download_conf = getattr(provider_config, download_topic_key)
|
|
773
|
+
if not getattr(download_conf, "output_dir", None):
|
|
774
|
+
download_conf.output_dir = tempfile.gettempdir()
|
|
775
|
+
if not getattr(download_conf, "delete_archive", None):
|
|
776
|
+
download_conf.delete_archive = True
|
|
491
777
|
|
|
492
778
|
try:
|
|
493
779
|
if (
|
|
@@ -514,9 +800,7 @@ def override_config_from_file(config: Dict[str, Any], file_path: str) -> None:
|
|
|
514
800
|
"""Override a configuration with the values in a file
|
|
515
801
|
|
|
516
802
|
:param config: An eodag providers configuration dictionary
|
|
517
|
-
:type config: dict
|
|
518
803
|
:param file_path: The path to the file from where the new values will be read
|
|
519
|
-
:type file_path: str
|
|
520
804
|
"""
|
|
521
805
|
logger.info("Loading user configuration from: %s", os.path.abspath(file_path))
|
|
522
806
|
with open(os.path.abspath(os.path.realpath(file_path)), "r") as fh:
|
|
@@ -534,7 +818,6 @@ def override_config_from_env(config: Dict[str, Any]) -> None:
|
|
|
534
818
|
"""Override a configuration with environment variables values
|
|
535
819
|
|
|
536
820
|
:param config: An eodag providers configuration dictionary
|
|
537
|
-
:type config: dict
|
|
538
821
|
"""
|
|
539
822
|
|
|
540
823
|
def build_mapping_from_env(
|
|
@@ -554,11 +837,8 @@ def override_config_from_env(config: Dict[str, Any]) -> None:
|
|
|
554
837
|
}
|
|
555
838
|
|
|
556
839
|
:param env_var: The environment variable to be transformed into a dictionary
|
|
557
|
-
:type env_var: str
|
|
558
840
|
:param env_value: The value from environment variable
|
|
559
|
-
:type env_value: str
|
|
560
841
|
:param mapping: The mapping in which the value will be created
|
|
561
|
-
:type mapping: dict
|
|
562
842
|
"""
|
|
563
843
|
parts = env_var.split("__")
|
|
564
844
|
iter_parts = iter(parts)
|
|
@@ -610,11 +890,39 @@ def override_config_from_mapping(
|
|
|
610
890
|
"""Override a configuration with the values in a mapping
|
|
611
891
|
|
|
612
892
|
:param config: An eodag providers configuration dictionary
|
|
613
|
-
:type config: dict
|
|
614
893
|
:param mapping: The mapping containing the values to be overriden
|
|
615
|
-
:type mapping: dict
|
|
616
894
|
"""
|
|
617
895
|
for provider, new_conf in mapping.items():
|
|
896
|
+
# check if metada-mapping as already been built as jsonpath in providers_config
|
|
897
|
+
if not isinstance(new_conf, dict):
|
|
898
|
+
continue
|
|
899
|
+
new_conf_search = new_conf.get("search", {}) or {}
|
|
900
|
+
new_conf_api = new_conf.get("api", {}) or {}
|
|
901
|
+
if provider in config and "metadata_mapping" in {
|
|
902
|
+
**new_conf_search,
|
|
903
|
+
**new_conf_api,
|
|
904
|
+
}:
|
|
905
|
+
search_plugin_key = (
|
|
906
|
+
"search" if "metadata_mapping" in new_conf_search else "api"
|
|
907
|
+
)
|
|
908
|
+
# get some already configured value
|
|
909
|
+
configured_metadata_mapping = getattr(
|
|
910
|
+
config[provider], search_plugin_key
|
|
911
|
+
).metadata_mapping
|
|
912
|
+
some_configured_value = next(iter(configured_metadata_mapping.values()))
|
|
913
|
+
# check if the configured value has already been built as jsonpath
|
|
914
|
+
if (
|
|
915
|
+
isinstance(some_configured_value, list)
|
|
916
|
+
and isinstance(some_configured_value[1], tuple)
|
|
917
|
+
or isinstance(some_configured_value, tuple)
|
|
918
|
+
):
|
|
919
|
+
# also build as jsonpath the incoming conf
|
|
920
|
+
mtd_cfg_as_conversion_and_querypath(
|
|
921
|
+
deepcopy(mapping[provider][search_plugin_key]["metadata_mapping"]),
|
|
922
|
+
mapping[provider][search_plugin_key]["metadata_mapping"],
|
|
923
|
+
)
|
|
924
|
+
|
|
925
|
+
# try overriding conf
|
|
618
926
|
old_conf: Optional[Dict[str, Any]] = config.get(provider)
|
|
619
927
|
if old_conf is not None:
|
|
620
928
|
old_conf.update(new_conf)
|
|
@@ -640,9 +948,7 @@ def merge_configs(config: Dict[str, Any], other_config: Dict[str, Any]) -> None:
|
|
|
640
948
|
"""Override a configuration with the values of another configuration
|
|
641
949
|
|
|
642
950
|
:param config: An eodag providers configuration dictionary
|
|
643
|
-
:type config: dict
|
|
644
951
|
:param other_config: An eodag providers configuration dictionary
|
|
645
|
-
:type other_config: dict
|
|
646
952
|
"""
|
|
647
953
|
# configs union with other_config values as default
|
|
648
954
|
other_config = dict(config, **other_config)
|
|
@@ -671,20 +977,18 @@ def merge_configs(config: Dict[str, Any], other_config: Dict[str, Any]) -> None:
|
|
|
671
977
|
|
|
672
978
|
|
|
673
979
|
def load_yml_config(yml_path: str) -> Dict[Any, Any]:
|
|
674
|
-
"""Load a conf
|
|
980
|
+
"""Load a conf dictionary from given yml absolute path
|
|
675
981
|
|
|
676
982
|
:returns: The yml configuration file
|
|
677
|
-
:rtype: dict
|
|
678
983
|
"""
|
|
679
984
|
config = SimpleYamlProxyConfig(yml_path)
|
|
680
985
|
return dict_items_recursive_apply(config.source, string_to_jsonpath)
|
|
681
986
|
|
|
682
987
|
|
|
683
988
|
def load_stac_config() -> Dict[str, Any]:
|
|
684
|
-
"""Load the stac configuration into a
|
|
989
|
+
"""Load the stac configuration into a dictionary
|
|
685
990
|
|
|
686
991
|
:returns: The stac configuration
|
|
687
|
-
:rtype: dict
|
|
688
992
|
"""
|
|
689
993
|
return load_yml_config(
|
|
690
994
|
resource_filename("eodag", os.path.join("resources/", "stac.yml"))
|
|
@@ -692,10 +996,9 @@ def load_stac_config() -> Dict[str, Any]:
|
|
|
692
996
|
|
|
693
997
|
|
|
694
998
|
def load_stac_api_config() -> Dict[str, Any]:
|
|
695
|
-
"""Load the stac API configuration into a
|
|
999
|
+
"""Load the stac API configuration into a dictionary
|
|
696
1000
|
|
|
697
1001
|
:returns: The stac API configuration
|
|
698
|
-
:rtype: dict
|
|
699
1002
|
"""
|
|
700
1003
|
return load_yml_config(
|
|
701
1004
|
resource_filename("eodag", os.path.join("resources/", "stac_api.yml"))
|
|
@@ -703,10 +1006,9 @@ def load_stac_api_config() -> Dict[str, Any]:
|
|
|
703
1006
|
|
|
704
1007
|
|
|
705
1008
|
def load_stac_provider_config() -> Dict[str, Any]:
|
|
706
|
-
"""Load the stac provider configuration into a
|
|
1009
|
+
"""Load the stac provider configuration into a dictionary
|
|
707
1010
|
|
|
708
1011
|
:returns: The stac provider configuration
|
|
709
|
-
:rtype: dict
|
|
710
1012
|
"""
|
|
711
1013
|
return SimpleYamlProxyConfig(
|
|
712
1014
|
resource_filename("eodag", os.path.join("resources/", "stac_provider.yml"))
|
|
@@ -719,9 +1021,7 @@ def get_ext_product_types_conf(
|
|
|
719
1021
|
"""Read external product types conf
|
|
720
1022
|
|
|
721
1023
|
:param conf_uri: URI to local or remote configuration file
|
|
722
|
-
:type conf_uri: str
|
|
723
1024
|
:returns: The external product types configuration
|
|
724
|
-
:rtype: dict
|
|
725
1025
|
"""
|
|
726
1026
|
logger.info("Fetching external product types from %s", conf_uri)
|
|
727
1027
|
if conf_uri.lower().startswith("http"):
|