eodag 3.0.0b3__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/api/core.py +189 -125
- eodag/api/product/metadata_mapping.py +12 -3
- eodag/api/search_result.py +29 -3
- eodag/cli.py +35 -19
- eodag/config.py +412 -116
- eodag/plugins/apis/base.py +10 -4
- eodag/plugins/apis/ecmwf.py +14 -4
- eodag/plugins/apis/usgs.py +25 -2
- eodag/plugins/authentication/aws_auth.py +14 -5
- 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 +178 -163
- eodag/plugins/authentication/qsauth.py +12 -4
- eodag/plugins/authentication/sas_auth.py +19 -2
- eodag/plugins/authentication/token.py +57 -10
- eodag/plugins/authentication/token_exchange.py +19 -19
- eodag/plugins/crunch/base.py +4 -1
- eodag/plugins/crunch/filter_date.py +5 -2
- eodag/plugins/crunch/filter_latest_intersect.py +5 -4
- eodag/plugins/crunch/filter_latest_tpl_name.py +1 -1
- eodag/plugins/crunch/filter_overlap.py +5 -7
- eodag/plugins/crunch/filter_property.py +4 -3
- eodag/plugins/download/aws.py +39 -22
- eodag/plugins/download/base.py +11 -11
- eodag/plugins/download/creodias_s3.py +11 -2
- eodag/plugins/download/http.py +86 -52
- eodag/plugins/download/s3rest.py +20 -18
- eodag/plugins/manager.py +168 -23
- eodag/plugins/search/base.py +33 -14
- eodag/plugins/search/build_search_result.py +55 -51
- eodag/plugins/search/cop_marine.py +112 -29
- eodag/plugins/search/creodias_s3.py +20 -5
- eodag/plugins/search/csw.py +41 -1
- eodag/plugins/search/data_request_search.py +109 -9
- eodag/plugins/search/qssearch.py +532 -152
- eodag/plugins/search/static_stac_search.py +20 -21
- eodag/resources/ext_product_types.json +1 -1
- eodag/resources/product_types.yml +187 -56
- eodag/resources/providers.yml +1610 -1701
- eodag/resources/stac.yml +3 -163
- eodag/resources/user_conf_template.yml +112 -97
- eodag/rest/config.py +1 -2
- eodag/rest/constants.py +0 -1
- eodag/rest/core.py +61 -51
- eodag/rest/errors.py +181 -0
- eodag/rest/server.py +24 -325
- eodag/rest/stac.py +93 -544
- eodag/rest/types/eodag_search.py +13 -8
- eodag/rest/types/queryables.py +1 -2
- eodag/rest/types/stac_search.py +11 -2
- eodag/types/__init__.py +15 -3
- eodag/types/download_args.py +1 -1
- eodag/types/queryables.py +1 -2
- eodag/types/search_args.py +3 -3
- eodag/utils/__init__.py +77 -57
- eodag/utils/exceptions.py +23 -9
- eodag/utils/logging.py +37 -77
- eodag/utils/requests.py +1 -3
- eodag/utils/stac_reader.py +1 -1
- {eodag-3.0.0b3.dist-info → eodag-3.0.1.dist-info}/METADATA +11 -12
- eodag-3.0.1.dist-info/RECORD +109 -0
- {eodag-3.0.0b3.dist-info → eodag-3.0.1.dist-info}/WHEEL +1 -1
- {eodag-3.0.0b3.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.0b3.dist-info/RECORD +0 -110
- {eodag-3.0.0b3.dist-info → eodag-3.0.1.dist-info}/LICENSE +0 -0
- {eodag-3.0.0b3.dist-info → eodag-3.0.1.dist-info}/top_level.txt +0 -0
|
@@ -58,9 +58,107 @@ logger = logging.getLogger("eodag.search.data_request_search")
|
|
|
58
58
|
class DataRequestSearch(Search):
|
|
59
59
|
"""
|
|
60
60
|
Plugin to execute search requests composed of several steps:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
|
|
62
|
+
#. do a data request which defines which data shall be searched
|
|
63
|
+
#. check the status of the request job
|
|
64
|
+
#. if finished - fetch the result of the job
|
|
65
|
+
|
|
66
|
+
:param provider: provider name
|
|
67
|
+
:param config: Search plugin configuration:
|
|
68
|
+
|
|
69
|
+
* :attr:`~eodag.config.PluginConfig.api_endpoint` (``str``) (**mandatory**): The endpoint of the
|
|
70
|
+
provider's search interface
|
|
71
|
+
* :attr:`~eodag.config.PluginConfig.results_entry` (``str``) (**mandatory**): The name of
|
|
72
|
+
the key in the provider search result that gives access to the result entries
|
|
73
|
+
* :attr:`~eodag.config.PluginConfig.data_request_url` (``str``) (**mandatory**): url
|
|
74
|
+
to which the data request shall be sent
|
|
75
|
+
* :attr:`~eodag.config.PluginConfig.status_url` (``str``) (**mandatory**): url to fetch
|
|
76
|
+
the status of the data request
|
|
77
|
+
* :attr:`~eodag.config.PluginConfig.result_url` (``str``) (**mandatory**): url to fetch
|
|
78
|
+
the search result when the data request is done
|
|
79
|
+
* :attr:`~eodag.config.PluginConfig.need_auth` (``bool``): if authentication is needed for
|
|
80
|
+
the search request; default: ``False``
|
|
81
|
+
* :attr:`~eodag.config.PluginConfig.auth_error_code` (``int``): which error code is returned in case of an
|
|
82
|
+
authentication error; only used if ``need_auth=true``
|
|
83
|
+
* :attr:`~eodag.config.PluginConfig.ssl_verify` (``bool``): if the ssl certificates should be
|
|
84
|
+
verified in requests; default: ``True``
|
|
85
|
+
* :attr:`~eodag.config.PluginConfig.timeout` (``int``): time to wait until request timeout in seconds;
|
|
86
|
+
default: ``5``
|
|
87
|
+
* :attr:`~eodag.config.PluginConfig.dates_required` (``bool``): if date parameters are mandatory
|
|
88
|
+
in the request; default: ``True``
|
|
89
|
+
* :attr:`~eodag.config.PluginConfig.pagination` (:class:`~eodag.config.PluginConfig.Pagination`)
|
|
90
|
+
(**mandatory**): The configuration of how the pagination is done on the provider. It is a tree with the
|
|
91
|
+
following nodes:
|
|
92
|
+
|
|
93
|
+
* :attr:`~eodag.config.PluginConfig.Pagination.total_items_nb_key_path` (``str``): An XPath or JsonPath
|
|
94
|
+
leading to the total number of results satisfying a request. This is used for providers which provides the
|
|
95
|
+
total results metadata along with the result of the query and don't have an endpoint for querying
|
|
96
|
+
the number of items satisfying a request, or for providers for which the count endpoint
|
|
97
|
+
returns a json or xml document
|
|
98
|
+
* :attr:`~eodag.config.PluginConfig.Pagination.max_items_per_page` (``int``): The maximum
|
|
99
|
+
number of items per page that the provider can handle; default: ``50``
|
|
100
|
+
* :attr:`~eodag.config.PluginConfig.Pagination.start_page` (``int``): number of the
|
|
101
|
+
first page; default: ``1``
|
|
102
|
+
|
|
103
|
+
* :attr:`~eodag.config.PluginConfig.discover_product_types`
|
|
104
|
+
(:class:`~eodag.config.PluginConfig.DiscoverProductTypes`): configuration for product type discovery based on
|
|
105
|
+
information from the provider; It contains the keys:
|
|
106
|
+
|
|
107
|
+
* :attr:`~eodag.config.PluginConfig.DiscoverProductTypes.fetch_url` (``str``) (**mandatory**): url from which
|
|
108
|
+
the product types can be fetched
|
|
109
|
+
* :attr:`~eodag.config.PluginConfig.DiscoverProductTypes.result_type` (``str``): type of the provider result;
|
|
110
|
+
currently only ``json`` is supported (other types could be used in an extension of this plugin)
|
|
111
|
+
* :attr:`~eodag.config.PluginConfig.DiscoverProductTypes.results_entry` (``str``) (**mandatory**): json path
|
|
112
|
+
to the list of product types
|
|
113
|
+
* :attr:`~eodag.config.PluginConfig.DiscoverProductTypes.generic_product_type_id` (``str``): mapping for the
|
|
114
|
+
product type id
|
|
115
|
+
* :attr:`~eodag.config.PluginConfig.DiscoverProductTypes.generic_product_type_parsable_metadata`
|
|
116
|
+
(``Dict[str, str]``): mapping for product type metadata (e.g. ``abstract``, ``licence``) which can be parsed
|
|
117
|
+
from the provider result
|
|
118
|
+
* :attr:`~eodag.config.PluginConfig.DiscoverProductTypes.generic_product_type_parsable_properties`
|
|
119
|
+
(``Dict[str, str]``): mapping for product type properties which can be parsed from the result that are not
|
|
120
|
+
product type metadata
|
|
121
|
+
* :attr:`~eodag.config.PluginConfig.DiscoverProductTypes.single_collection_fetch_url` (``str``): url to fetch
|
|
122
|
+
data for a single collection; used if product type metadata is not available from the endpoint given in
|
|
123
|
+
:attr:`~eodag.config.PluginConfig.DiscoverProductTypes.fetch_url`
|
|
124
|
+
* :attr:`~eodag.config.PluginConfig.DiscoverProductTypes.single_collection_fetch_qs` (``str``): query string
|
|
125
|
+
to be added to the :attr:`~eodag.config.PluginConfig.DiscoverProductTypes.fetch_url` to filter for a
|
|
126
|
+
collection
|
|
127
|
+
* :attr:`~eodag.config.PluginConfig.DiscoverProductTypes.single_product_type_parsable_metadata`
|
|
128
|
+
(``Dict[str, str]``): mapping for product type metadata returned by the endpoint given in
|
|
129
|
+
:attr:`~eodag.config.PluginConfig.DiscoverProductTypes.single_collection_fetch_url`.
|
|
130
|
+
|
|
131
|
+
* :attr:`~eodag.config.PluginConfig.constraints_file_url` (``str``): url to fetch the constraints for a specific
|
|
132
|
+
product type, can be an http url or a path to a file; the constraints are used to build queryables
|
|
133
|
+
* :attr:`~eodag.config.PluginConfig.constraints_entry` (``str``): key in the json result where the constraints
|
|
134
|
+
can be found; if not given, it is assumed that the constraints are on top level of the result, i.e.
|
|
135
|
+
the result is an array of constraints
|
|
136
|
+
* :attr:`~eodag.config.PluginConfig.metadata_mapping` (``Dict[str, Any]``): The search plugins of this kind can
|
|
137
|
+
detect when a metadata mapping is "query-able", and get the semantics of how to format the query string
|
|
138
|
+
parameter that enables to make a query on the corresponding metadata. To make a metadata query-able,
|
|
139
|
+
just configure it in the metadata mapping to be a list of 2 items, the first one being the
|
|
140
|
+
specification of the query string search formatting. The later is a string following the
|
|
141
|
+
specification of Python string formatting, with a special behaviour added to it. For example,
|
|
142
|
+
an entry in the metadata mapping of this kind::
|
|
143
|
+
|
|
144
|
+
completionTimeFromAscendingNode:
|
|
145
|
+
- 'f=acquisition.endViewingDate:lte:{completionTimeFromAscendingNode#timestamp}'
|
|
146
|
+
- '$.properties.acquisition.endViewingDate'
|
|
147
|
+
|
|
148
|
+
means that the search url will have a query string parameter named ``f`` with a value of
|
|
149
|
+
``acquisition.endViewingDate:lte:1543922280.0`` if the search was done with the value
|
|
150
|
+
of ``completionTimeFromAscendingNode`` being ``2018-12-04T12:18:00``. What happened is that
|
|
151
|
+
``{completionTimeFromAscendingNode#timestamp}`` was replaced with the timestamp of the value
|
|
152
|
+
of ``completionTimeFromAscendingNode``. This example shows all there is to know about the
|
|
153
|
+
semantics of the query string formatting introduced by this plugin: any eodag search parameter
|
|
154
|
+
can be referenced in the query string with an additional optional conversion function that
|
|
155
|
+
is separated from it by a ``#`` (see :func:`~eodag.api.product.metadata_mapping.format_metadata` for further
|
|
156
|
+
details on the available converters). Note that for the values in the
|
|
157
|
+
:attr:`~eodag.config.PluginConfig.free_text_search_operations` configuration parameter follow the same rule.
|
|
158
|
+
If the metadata_mapping is not a list but only a string, this means that the parameters is not queryable but
|
|
159
|
+
it is included in the result obtained from the provider. The string indicates how the provider result should
|
|
160
|
+
be mapped to the eodag parameter.
|
|
161
|
+
|
|
64
162
|
"""
|
|
65
163
|
|
|
66
164
|
data_request_id: Optional[str]
|
|
@@ -275,9 +373,9 @@ class DataRequestSearch(Search):
|
|
|
275
373
|
except requests.exceptions.Timeout as exc:
|
|
276
374
|
raise TimeOutError(exc, timeout=HTTP_REQ_TIMEOUT) from exc
|
|
277
375
|
except requests.RequestException as e:
|
|
278
|
-
raise RequestError(
|
|
279
|
-
f"search job for product_type {product_type} could not be created
|
|
280
|
-
)
|
|
376
|
+
raise RequestError.from_error(
|
|
377
|
+
e, f"search job for product_type {product_type} could not be created"
|
|
378
|
+
) from e
|
|
281
379
|
else:
|
|
282
380
|
logger.info("search job for product_type %s created", product_type)
|
|
283
381
|
return request_job.json()["jobId"]
|
|
@@ -294,7 +392,7 @@ class DataRequestSearch(Search):
|
|
|
294
392
|
except requests.exceptions.Timeout as exc:
|
|
295
393
|
raise TimeOutError(exc, timeout=HTTP_REQ_TIMEOUT) from exc
|
|
296
394
|
except requests.RequestException as e:
|
|
297
|
-
raise RequestError(
|
|
395
|
+
raise RequestError.from_error(e, "_cancel_request failed") from e
|
|
298
396
|
|
|
299
397
|
def _check_request_status(self, data_request_id: str) -> bool:
|
|
300
398
|
logger.debug("checking status of request job %s", data_request_id)
|
|
@@ -313,7 +411,7 @@ class DataRequestSearch(Search):
|
|
|
313
411
|
except requests.exceptions.Timeout as exc:
|
|
314
412
|
raise TimeOutError(exc, timeout=HTTP_REQ_TIMEOUT) from exc
|
|
315
413
|
except requests.RequestException as e:
|
|
316
|
-
raise RequestError(
|
|
414
|
+
raise RequestError.from_error(e, "_check_request_status failed") from e
|
|
317
415
|
else:
|
|
318
416
|
status_data = status_resp.json()
|
|
319
417
|
if "status_code" in status_data and status_data["status_code"] in [
|
|
@@ -321,7 +419,9 @@ class DataRequestSearch(Search):
|
|
|
321
419
|
404,
|
|
322
420
|
]:
|
|
323
421
|
logger.error(f"_check_request_status failed: {status_data}")
|
|
324
|
-
|
|
422
|
+
error = RequestError("authentication token expired during request")
|
|
423
|
+
error.status_code = status_data["status_code"]
|
|
424
|
+
raise error
|
|
325
425
|
if status_data["status"] == "failed":
|
|
326
426
|
logger.error(f"_check_request_status failed: {status_data}")
|
|
327
427
|
raise RequestError(
|