eodag 3.0.0b2__py3-none-any.whl → 3.0.0b3__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.
Files changed (65) hide show
  1. eodag/__init__.py +6 -8
  2. eodag/api/core.py +113 -169
  3. eodag/api/product/__init__.py +10 -4
  4. eodag/api/product/_assets.py +2 -14
  5. eodag/api/product/_product.py +16 -30
  6. eodag/api/product/drivers/__init__.py +7 -2
  7. eodag/api/product/drivers/base.py +0 -3
  8. eodag/api/product/metadata_mapping.py +0 -28
  9. eodag/api/search_result.py +4 -9
  10. eodag/config.py +45 -41
  11. eodag/plugins/apis/base.py +3 -3
  12. eodag/plugins/apis/ecmwf.py +2 -3
  13. eodag/plugins/apis/usgs.py +43 -14
  14. eodag/plugins/authentication/aws_auth.py +11 -2
  15. eodag/plugins/authentication/openid_connect.py +5 -4
  16. eodag/plugins/authentication/token.py +2 -1
  17. eodag/plugins/crunch/base.py +3 -1
  18. eodag/plugins/crunch/filter_date.py +3 -9
  19. eodag/plugins/crunch/filter_latest_intersect.py +0 -3
  20. eodag/plugins/crunch/filter_latest_tpl_name.py +1 -4
  21. eodag/plugins/crunch/filter_overlap.py +4 -8
  22. eodag/plugins/crunch/filter_property.py +5 -11
  23. eodag/plugins/download/aws.py +46 -78
  24. eodag/plugins/download/base.py +27 -68
  25. eodag/plugins/download/http.py +48 -57
  26. eodag/plugins/download/s3rest.py +17 -25
  27. eodag/plugins/manager.py +5 -18
  28. eodag/plugins/search/__init__.py +9 -9
  29. eodag/plugins/search/base.py +7 -26
  30. eodag/plugins/search/build_search_result.py +0 -13
  31. eodag/plugins/search/cop_marine.py +1 -3
  32. eodag/plugins/search/creodias_s3.py +0 -3
  33. eodag/plugins/search/data_request_search.py +10 -5
  34. eodag/plugins/search/qssearch.py +95 -53
  35. eodag/plugins/search/static_stac_search.py +6 -3
  36. eodag/resources/ext_product_types.json +1 -1
  37. eodag/resources/product_types.yml +24 -0
  38. eodag/resources/providers.yml +198 -154
  39. eodag/resources/user_conf_template.yml +27 -27
  40. eodag/rest/core.py +11 -43
  41. eodag/rest/server.py +1 -6
  42. eodag/rest/stac.py +13 -87
  43. eodag/rest/types/eodag_search.py +4 -7
  44. eodag/rest/types/queryables.py +4 -12
  45. eodag/rest/types/stac_search.py +7 -11
  46. eodag/rest/utils/rfc3339.py +0 -1
  47. eodag/types/__init__.py +9 -3
  48. eodag/types/download_args.py +14 -5
  49. eodag/types/search_args.py +7 -8
  50. eodag/types/whoosh.py +0 -2
  51. eodag/utils/__init__.py +20 -79
  52. eodag/utils/constraints.py +0 -8
  53. eodag/utils/import_system.py +0 -4
  54. eodag/utils/logging.py +0 -3
  55. eodag/utils/notebook.py +4 -4
  56. eodag/utils/requests.py +12 -20
  57. eodag/utils/rest.py +0 -4
  58. eodag/utils/stac_reader.py +2 -14
  59. {eodag-3.0.0b2.dist-info → eodag-3.0.0b3.dist-info}/METADATA +32 -14
  60. eodag-3.0.0b3.dist-info/RECORD +110 -0
  61. {eodag-3.0.0b2.dist-info → eodag-3.0.0b3.dist-info}/WHEEL +1 -1
  62. eodag-3.0.0b2.dist-info/RECORD +0 -110
  63. {eodag-3.0.0b2.dist-info → eodag-3.0.0b3.dist-info}/LICENSE +0 -0
  64. {eodag-3.0.0b2.dist-info → eodag-3.0.0b3.dist-info}/entry_points.txt +0 -0
  65. {eodag-3.0.0b2.dist-info → eodag-3.0.0b3.dist-info}/top_level.txt +0 -0
eodag/api/core.py CHANGED
@@ -66,10 +66,10 @@ from eodag.utils import (
66
66
  MockResponse,
67
67
  _deprecated,
68
68
  copy_deepcopy,
69
- deepcopy,
70
69
  get_geometry_from_various,
71
70
  makedirs,
72
71
  obj_md5sum,
72
+ sort_dict,
73
73
  string_to_jsonpath,
74
74
  uri_to_path,
75
75
  )
@@ -106,9 +106,7 @@ class EODataAccessGateway:
106
106
  from different types of providers.
107
107
 
108
108
  :param user_conf_file_path: (optional) Path to the user configuration file
109
- :type user_conf_file_path: str
110
109
  :param locations_conf_path: (optional) Path to the locations configuration file
111
- :type locations_conf_path: str
112
110
  """
113
111
 
114
112
  def __init__(
@@ -312,7 +310,6 @@ class EODataAccessGateway:
312
310
 
313
311
  :param provider: The name of the provider that should be considered as the
314
312
  preferred provider to be used for this instance
315
- :type provider: str
316
313
  """
317
314
  if provider not in self.available_providers():
318
315
  raise UnsupportedProvider(
@@ -328,7 +325,6 @@ class EODataAccessGateway:
328
325
  products, along with its priority.
329
326
 
330
327
  :returns: The provider with the maximum priority and its priority
331
- :rtype: tuple(str, int)
332
328
  """
333
329
  providers_with_priority = [
334
330
  (provider, conf.priority)
@@ -343,7 +339,6 @@ class EODataAccessGateway:
343
339
  an existing one.
344
340
 
345
341
  :param yaml_conf: YAML formated provider configuration
346
- :type yaml_conf: str
347
342
  """
348
343
  conf_update = yaml.safe_load(yaml_conf)
349
344
 
@@ -358,39 +353,6 @@ class EODataAccessGateway:
358
353
  provider
359
354
  )
360
355
 
361
- # check if metada-mapping as already been built as jsonpath in providers_config
362
- for provider, provider_conf in conf_update.items():
363
- if (
364
- provider in self.providers_config
365
- and "metadata_mapping" in provider_conf.get("search", {})
366
- ):
367
- search_plugin_key = "search"
368
- elif (
369
- provider in self.providers_config
370
- and "metadata_mapping" in provider_conf.get("api", {})
371
- ):
372
- search_plugin_key = "api"
373
- else:
374
- continue
375
- # get some already configured value
376
- configured_metadata_mapping = getattr(
377
- self.providers_config[provider], search_plugin_key
378
- ).metadata_mapping
379
- some_configured_value = next(iter(configured_metadata_mapping.values()))
380
- # check if the configured value has already been built as jsonpath
381
- if (
382
- isinstance(some_configured_value, list)
383
- and isinstance(some_configured_value[1], tuple)
384
- or isinstance(some_configured_value, tuple)
385
- ):
386
- # also build as jsonpath the incoming conf
387
- mtd_cfg_as_conversion_and_querypath(
388
- deepcopy(
389
- conf_update[provider][search_plugin_key]["metadata_mapping"]
390
- ),
391
- conf_update[provider][search_plugin_key]["metadata_mapping"],
392
- )
393
-
394
356
  override_config_from_mapping(self.providers_config, conf_update)
395
357
 
396
358
  stac_provider_config = load_stac_provider_config()
@@ -400,6 +362,75 @@ class EODataAccessGateway:
400
362
  # re-create _plugins_manager using up-to-date providers_config
401
363
  self._plugins_manager.build_product_type_to_provider_config_map()
402
364
 
365
+ def add_provider(
366
+ self,
367
+ name: str,
368
+ url: Optional[str] = None,
369
+ priority: Optional[int] = None,
370
+ search: Dict[str, Any] = {"type": "StacSearch"},
371
+ products: Dict[str, Any] = {
372
+ GENERIC_PRODUCT_TYPE: {"productType": "{productType}"}
373
+ },
374
+ download: Dict[str, Any] = {"type": "HTTPDownload", "auth_error_code": 401},
375
+ **kwargs: Dict[str, Any],
376
+ ):
377
+ """Adds a new provider.
378
+
379
+ ``search``, ``products`` & ``download`` already have default values that will be
380
+ updated (not replaced), with user provided ones:
381
+
382
+ * ``search`` : ``{"type": "StacSearch"}``
383
+ * ``products`` : ``{"GENERIC_PRODUCT_TYPE": {"productType": "{productType}"}}``
384
+ * ``download`` : ``{"type": "HTTPDownload", "auth_error_code": 401}``
385
+
386
+ :param name: Name of provider
387
+ :param url: Provider url, also used as ``search["api_endpoint"]`` if not defined
388
+ :param priority: Provider priority. If None, provider will be set as preferred (highest priority)
389
+ :param search: Search :class:`~eodag.config.PluginConfig` mapping
390
+ :param products: Provider product types mapping
391
+ :param download: Download :class:`~eodag.config.PluginConfig` mapping
392
+ :param kwargs: Additional :class:`~eodag.config.ProviderConfig` mapping
393
+ """
394
+ conf_dict: Dict[str, Any] = {
395
+ name: {
396
+ "url": url,
397
+ "search": {"type": "StacSearch", **search},
398
+ "products": {
399
+ GENERIC_PRODUCT_TYPE: {"productType": "{productType}"},
400
+ **products,
401
+ },
402
+ "download": {
403
+ "type": "HTTPDownload",
404
+ "auth_error_code": 401,
405
+ **download,
406
+ },
407
+ **kwargs,
408
+ }
409
+ }
410
+ if priority is not None:
411
+ conf_dict[name]["priority"] = priority
412
+ # if provided, use url as default search api_endpoint
413
+ if (
414
+ url
415
+ and conf_dict[name].get("search", {})
416
+ and not conf_dict[name]["search"].get("api_endpoint")
417
+ ):
418
+ conf_dict[name]["search"]["api_endpoint"] = url
419
+
420
+ # api plugin usage: remove unneeded search/download/auth plugin conf
421
+ if conf_dict[name].get("api"):
422
+ conf_dict[name].pop("search", None)
423
+ conf_dict[name].pop("download", None)
424
+ conf_dict[name].pop("auth", None)
425
+
426
+ override_config_from_mapping(self.providers_config, conf_dict)
427
+ provider_config_init(self.providers_config[name], load_stac_provider_config())
428
+ setattr(self.providers_config[name], "product_types_fetched", False)
429
+ self._plugins_manager.build_product_type_to_provider_config_map()
430
+
431
+ if priority is None:
432
+ self.set_preferred_provider(name)
433
+
403
434
  def _prune_providers_list(self) -> None:
404
435
  """Removes from config providers needing auth that have no credentials set."""
405
436
  update_needed = False
@@ -502,7 +533,6 @@ class EODataAccessGateway:
502
533
  attr: FRA
503
534
 
504
535
  :param locations_conf_path: Path to the locations configuration file
505
- :type locations_conf_path: str
506
536
  """
507
537
  if os.path.isfile(locations_conf_path):
508
538
  locations_config = load_yml_config(locations_conf_path)
@@ -525,12 +555,9 @@ class EODataAccessGateway:
525
555
 
526
556
  :param provider: (optional) The name of a provider that must support the product
527
557
  types we are about to list
528
- :type provider: str
529
558
  :param fetch_providers: (optional) Whether to fetch providers for new product
530
559
  types or not
531
- :type fetch_providers: bool
532
560
  :returns: The list of the product types that can be accessed using eodag.
533
- :rtype: list(dict)
534
561
  :raises: :class:`~eodag.utils.exceptions.UnsupportedProvider`
535
562
  """
536
563
  if fetch_providers:
@@ -574,7 +601,6 @@ class EODataAccessGateway:
574
601
 
575
602
  :param provider: (optional) The name of a provider for which product types list
576
603
  should be updated. Defaults to all providers (None value).
577
- :type provider: str
578
604
  """
579
605
  if provider is not None and provider not in self.providers_config:
580
606
  return
@@ -711,9 +737,7 @@ class EODataAccessGateway:
711
737
 
712
738
  :param provider: (optional) The name of a provider to fetch. Defaults to all
713
739
  providers (None value).
714
- :type provider: str
715
740
  :returns: external product types configuration
716
- :rtype: dict
717
741
  """
718
742
  if provider and provider not in self.providers_config:
719
743
  raise UnsupportedProvider(
@@ -742,6 +766,11 @@ class EODataAccessGateway:
742
766
  search_plugin: Union[Search, Api] = next(
743
767
  self._plugins_manager.get_search_plugins(provider=provider)
744
768
  )
769
+ # check after plugin init if still fetchable
770
+ if not getattr(search_plugin.config, "discover_product_types", {}).get(
771
+ "fetch_url"
772
+ ):
773
+ continue
745
774
  # append auth to search plugin if needed
746
775
  if getattr(search_plugin.config, "need_auth", False):
747
776
  auth_plugin = self._plugins_manager.get_auth_plugin(
@@ -769,7 +798,7 @@ class EODataAccessGateway:
769
798
  **kwargs
770
799
  )
771
800
 
772
- return ext_product_types_conf
801
+ return sort_dict(ext_product_types_conf)
773
802
 
774
803
  def update_product_types_list(
775
804
  self, ext_product_types_conf: Dict[str, Optional[Dict[str, Dict[str, Any]]]]
@@ -777,7 +806,6 @@ class EODataAccessGateway:
777
806
  """Update eodag product types list
778
807
 
779
808
  :param ext_product_types_conf: external product types configuration
780
- :type ext_product_types_conf: dict
781
809
  """
782
810
  for provider, new_product_types_conf in ext_product_types_conf.items():
783
811
  if new_product_types_conf and provider in self.providers_config:
@@ -870,12 +898,9 @@ class EODataAccessGateway:
870
898
  priority level.
871
899
 
872
900
  :param product_type: (optional) Only list providers configured for this product_type
873
- :type product_type: Optional[str]
874
901
  :param by_group: (optional) If set to True, list groups when available instead
875
902
  of providers, mixed with other providers
876
- :type by_group: bool
877
903
  :returns: the sorted list of the available providers or groups
878
- :rtype: List[str]
879
904
  """
880
905
 
881
906
  if product_type:
@@ -909,9 +934,7 @@ class EODataAccessGateway:
909
934
 
910
935
  :param alias_or_id: Alias of the product type. If an existing ID is given, this
911
936
  method will directly return the given value.
912
- :type alias_or_id: str
913
937
  :returns: Internal name of the product type.
914
- :rtype: str
915
938
  """
916
939
  product_types = [
917
940
  k
@@ -939,9 +962,7 @@ class EODataAccessGateway:
939
962
  given product type, its ID is returned instead.
940
963
 
941
964
  :param product_type: product type ID
942
- :type product_type: str
943
965
  :returns: Alias of the product type or its ID if no alias has been defined for it.
944
- :rtype: str
945
966
  """
946
967
  if product_type not in self.product_types_config:
947
968
  raise NoMatchingProductType(product_type)
@@ -972,31 +993,18 @@ class EODataAccessGateway:
972
993
 
973
994
  :param free_text: Whoosh-compatible free text search filter used to search
974
995
  accross all the following parameters
975
- :type free_text: Optional[str]
976
996
  :param intersect: Join results for each parameter using INTERSECT instead of UNION.
977
- :type intersect: bool
978
997
  :param instrument: Instrument parameter.
979
- :type instrument: Optional[str]
980
998
  :param platform: Platform parameter.
981
- :type platform: Optional[str]
982
999
  :param platformSerialIdentifier: Platform serial identifier parameter.
983
- :type platformSerialIdentifier: Optional[str]
984
1000
  :param processingLevel: Processing level parameter.
985
- :type processingLevel: Optional[str]
986
1001
  :param sensorType: Sensor type parameter.
987
- :type sensorType: Optional[str]
988
1002
  :param keywords: Keywords parameter.
989
- :type keywords: Optional[str]
990
1003
  :param abstract: Abstract parameter.
991
- :type abstract: Optional[str]
992
1004
  :param title: Title parameter.
993
- :type title: Optional[str]
994
1005
  :param missionStartDate: start date for datetime filtering. Not used by free_text
995
- :type missionStartDate: Optional[str]
996
1006
  :param missionEndDate: end date for datetime filtering. Not used by free_text
997
- :type missionEndDate: Optional[str]
998
1007
  :returns: The best match for the given parameters.
999
- :rtype: List[str]
1000
1008
  :raises: :class:`~eodag.utils.exceptions.NoMatchingProductType`
1001
1009
  """
1002
1010
  if productType := kwargs.get("productType"):
@@ -1083,21 +1091,16 @@ class EODataAccessGateway:
1083
1091
  Only if the request fails for all available providers, an error will be thrown.
1084
1092
 
1085
1093
  :param page: (optional) The page number to return
1086
- :type page: int
1087
1094
  :param items_per_page: (optional) The number of results that must appear in one single
1088
1095
  page
1089
- :type items_per_page: int
1090
1096
  :param raise_errors: (optional) When an error occurs when searching, if this is set to
1091
1097
  True, the error is raised
1092
- :type raise_errors: bool
1093
1098
  :param start: (optional) Start sensing time in ISO 8601 format (e.g. "1990-11-26",
1094
1099
  "1990-11-26T14:30:10.153Z", "1990-11-26T14:30:10+02:00", ...).
1095
1100
  If no time offset is given, the time is assumed to be given in UTC.
1096
- :type start: str
1097
1101
  :param end: (optional) End sensing time in ISO 8601 format (e.g. "1990-11-26",
1098
1102
  "1990-11-26T14:30:10.153Z", "1990-11-26T14:30:10+02:00", ...).
1099
1103
  If no time offset is given, the time is assumed to be given in UTC.
1100
- :type end: str
1101
1104
  :param geom: (optional) Search area that can be defined in different ways:
1102
1105
 
1103
1106
  * with a Shapely geometry object:
@@ -1107,24 +1110,22 @@ class EODataAccessGateway:
1107
1110
  * with a bounding box as list of float:
1108
1111
  ``[lonmin, latmin, lonmax, latmax]``
1109
1112
  * with a WKT str
1110
- :type geom: Union[str, dict, shapely.geometry.base.BaseGeometry]
1111
1113
  :param locations: (optional) Location filtering by name using locations configuration
1112
1114
  ``{"<location_name>"="<attr_regex>"}``. For example, ``{"country"="PA."}`` will use
1113
1115
  the geometry of the features having the property ISO3 starting with
1114
1116
  'PA' such as Panama and Pakistan in the shapefile configured with
1115
1117
  name=country and attr=ISO3
1116
- :type locations: dict
1117
1118
  :param provider: (optional) the provider to be used. If set, search fallback will be disabled.
1118
1119
  If not set, the configured preferred provider will be used at first
1119
1120
  before trying others until finding results.
1120
- :type provider: str
1121
1121
  :param count: (optional) Whether to run a query with a count request or not
1122
- :type count: bool
1123
1122
  :param kwargs: Some other criteria that will be used to do the search,
1124
1123
  using paramaters compatibles with the provider
1125
- :type kwargs: Union[int, str, bool, dict]
1126
1124
  :returns: A collection of EO products matching the criteria
1127
- :rtype: :class:`~eodag.api.search_result.SearchResult`
1125
+
1126
+ .. versionchanged:: v3.0.0b1
1127
+ ``search()`` method now returns only a single :class:`~eodag.api.search_result.SearchResult`
1128
+ instead of a 2 values tuple.
1128
1129
 
1129
1130
  .. note::
1130
1131
  The search interfaces, which are implemented as plugins, are required to
@@ -1188,15 +1189,12 @@ class EODataAccessGateway:
1188
1189
  """Iterate over the pages of a products search.
1189
1190
 
1190
1191
  :param items_per_page: (optional) The number of results requested per page
1191
- :type items_per_page: int
1192
1192
  :param start: (optional) Start sensing time in ISO 8601 format (e.g. "1990-11-26",
1193
1193
  "1990-11-26T14:30:10.153Z", "1990-11-26T14:30:10+02:00", ...).
1194
1194
  If no time offset is given, the time is assumed to be given in UTC.
1195
- :type start: str
1196
1195
  :param end: (optional) End sensing time in ISO 8601 format (e.g. "1990-11-26",
1197
1196
  "1990-11-26T14:30:10.153Z", "1990-11-26T14:30:10+02:00", ...).
1198
1197
  If no time offset is given, the time is assumed to be given in UTC.
1199
- :type end: str
1200
1198
  :param geom: (optional) Search area that can be defined in different ways:
1201
1199
 
1202
1200
  * with a Shapely geometry object:
@@ -1206,19 +1204,15 @@ class EODataAccessGateway:
1206
1204
  * with a bounding box as list of float:
1207
1205
  ``[lonmin, latmin, lonmax, latmax]``
1208
1206
  * with a WKT str
1209
- :type geom: Union[str, dict, shapely.geometry.base.BaseGeometry]
1210
1207
  :param locations: (optional) Location filtering by name using locations configuration
1211
1208
  ``{"<location_name>"="<attr_regex>"}``. For example, ``{"country"="PA."}`` will use
1212
1209
  the geometry of the features having the property ISO3 starting with
1213
1210
  'PA' such as Panama and Pakistan in the shapefile configured with
1214
1211
  name=country and attr=ISO3
1215
- :type locations: dict
1216
1212
  :param kwargs: Some other criteria that will be used to do the search,
1217
1213
  using paramaters compatibles with the provider
1218
- :type kwargs: Union[int, str, bool, dict]
1219
1214
  :returns: An iterator that yields page per page a collection of EO products
1220
1215
  matching the criteria
1221
- :rtype: Iterator[:class:`~eodag.api.search_result.SearchResult`]
1222
1216
  """
1223
1217
  search_plugins, search_kwargs = self._prepare_search(
1224
1218
  start=start, end=end, geom=geom, locations=locations, **kwargs
@@ -1253,15 +1247,11 @@ class EODataAccessGateway:
1253
1247
  """Iterate over the pages of a products search using a given search plugin.
1254
1248
 
1255
1249
  :param items_per_page: (optional) The number of results requested per page
1256
- :type items_per_page: int
1257
1250
  :param kwargs: Some other criteria that will be used to do the search,
1258
1251
  using parameters compatibles with the provider
1259
- :type kwargs: Union[int, str, bool, dict]
1260
1252
  :param search_plugin: search plugin to be used
1261
- :type search_plugin: eodag.plugins.search.base.Search
1262
1253
  :returns: An iterator that yields page per page a collection of EO products
1263
1254
  matching the criteria
1264
- :rtype: Iterator[:class:`~eodag.api.search_result.SearchResult`]
1265
1255
  """
1266
1256
 
1267
1257
  iteration = 1
@@ -1390,15 +1380,12 @@ class EODataAccessGateway:
1390
1380
  matching the search criteria. If this number is not
1391
1381
  available, a default value of 50 is used instead.
1392
1382
  items_per_page can also be set to any arbitrary value.
1393
- :type items_per_page: int
1394
1383
  :param start: (optional) Start sensing time in ISO 8601 format (e.g. "1990-11-26",
1395
1384
  "1990-11-26T14:30:10.153Z", "1990-11-26T14:30:10+02:00", ...).
1396
1385
  If no time offset is given, the time is assumed to be given in UTC.
1397
- :type start: str
1398
1386
  :param end: (optional) End sensing time in ISO 8601 format (e.g. "1990-11-26",
1399
1387
  "1990-11-26T14:30:10.153Z", "1990-11-26T14:30:10+02:00", ...).
1400
1388
  If no time offset is given, the time is assumed to be given in UTC.
1401
- :type end: str
1402
1389
  :param geom: (optional) Search area that can be defined in different ways:
1403
1390
 
1404
1391
  * with a Shapely geometry object:
@@ -1408,19 +1395,15 @@ class EODataAccessGateway:
1408
1395
  * with a bounding box as list of float:
1409
1396
  ``[lonmin, latmin, lonmax, latmax]``
1410
1397
  * with a WKT str
1411
- :type geom: Union[str, dict, shapely.geometry.base.BaseGeometry]
1412
1398
  :param locations: (optional) Location filtering by name using locations configuration
1413
1399
  ``{"<location_name>"="<attr_regex>"}``. For example, ``{"country"="PA."}`` will use
1414
1400
  the geometry of the features having the property ISO3 starting with
1415
1401
  'PA' such as Panama and Pakistan in the shapefile configured with
1416
1402
  name=country and attr=ISO3
1417
- :type locations: dict
1418
1403
  :param kwargs: Some other criteria that will be used to do the search,
1419
1404
  using parameters compatible with the provider
1420
- :type kwargs: Union[int, str, bool, dict]
1421
1405
  :returns: An iterator that yields page per page a collection of EO products
1422
1406
  matching the criteria
1423
- :rtype: Iterator[:class:`~eodag.api.search_result.SearchResult`]
1424
1407
  """
1425
1408
  # Get the search plugin and the maximized value
1426
1409
  # of items_per_page if defined for the provider used.
@@ -1509,15 +1492,11 @@ class EODataAccessGateway:
1509
1492
  perform the search, if this information is available
1510
1493
 
1511
1494
  :param uid: The uid of the EO product
1512
- :type uid: str
1513
1495
  :param provider: (optional) The provider on which to search the product.
1514
1496
  This may be useful for performance reasons when the user
1515
1497
  knows this product is available on the given provider
1516
- :type provider: str
1517
1498
  :param kwargs: Search criteria to help finding the right product
1518
- :type kwargs: Any
1519
1499
  :returns: A search result with one EO product or None at all
1520
- :rtype: :class:`~eodag.api.search_result.SearchResult`
1521
1500
  """
1522
1501
  product_type = kwargs.get("productType", None)
1523
1502
  if product_type is not None:
@@ -1597,6 +1576,10 @@ class EODataAccessGateway:
1597
1576
  plugins = self._plugins_manager.get_search_plugins(provider=provider)
1598
1577
  plugin = next(plugins)
1599
1578
 
1579
+ # check after plugin init if still fetchable
1580
+ if not getattr(plugin.config, "discover_product_types", {}).get("fetch_url"):
1581
+ return None
1582
+
1600
1583
  kwargs: Dict[str, Any] = {"productType": product_type}
1601
1584
 
1602
1585
  # append auth if needed
@@ -1641,25 +1624,18 @@ class EODataAccessGateway:
1641
1624
  :param start: (optional) Start sensing time in ISO 8601 format (e.g. "1990-11-26",
1642
1625
  "1990-11-26T14:30:10.153Z", "1990-11-26T14:30:10+02:00", ...).
1643
1626
  If no time offset is given, the time is assumed to be given in UTC.
1644
- :type start: str
1645
1627
  :param end: (optional) End sensing time in ISO 8601 format (e.g. "1990-11-26",
1646
1628
  "1990-11-26T14:30:10.153Z", "1990-11-26T14:30:10+02:00", ...).
1647
1629
  If no time offset is given, the time is assumed to be given in UTC.
1648
- :type end: str
1649
1630
  :param geom: (optional) Search area that can be defined in different ways (see search)
1650
- :type geom: Union[str, dict, shapely.geometry.base.BaseGeometry]
1651
1631
  :param locations: (optional) Location filtering by name using locations configuration
1652
- :type locations: dict
1653
1632
  :param provider: provider to be used, if no provider is given or the product type
1654
1633
  is not available for the provider, the preferred provider is used
1655
- :type provider: str
1656
1634
  :param kwargs: Some other criteria
1657
1635
  * id and/or a provider for a search by
1658
1636
  * search criteria to guess the product type
1659
1637
  * other criteria compatible with the provider
1660
- :type kwargs: Any
1661
1638
  :returns: Search plugins list and the prepared kwargs to make a query.
1662
- :rtype: tuple(list, dict)
1663
1639
  """
1664
1640
  product_type = kwargs.get("productType", None)
1665
1641
  if product_type is None:
@@ -1725,18 +1701,15 @@ class EODataAccessGateway:
1725
1701
  product_type
1726
1702
  not in self._plugins_manager.product_type_to_provider_config_map.keys()
1727
1703
  ):
1728
- logger.debug(
1729
- f"Fetching external product types sources to find {product_type} product type"
1730
- )
1731
1704
  if provider:
1732
1705
  # Try to get specific product type from external provider
1706
+ logger.debug(f"Fetching {provider} to find {product_type} product type")
1733
1707
  self._fetch_external_product_type(provider, product_type)
1734
- if (
1735
- not provider
1736
- or product_type
1737
- not in self._plugins_manager.product_type_to_provider_config_map.keys()
1738
- ):
1708
+ if not provider:
1739
1709
  # no provider or still not found -> fetch all external product types
1710
+ logger.debug(
1711
+ f"Fetching external product types sources to find {product_type} product type"
1712
+ )
1740
1713
  self.fetch_product_types_list()
1741
1714
 
1742
1715
  preferred_provider = self.get_preferred_provider()[0]
@@ -1814,16 +1787,11 @@ class EODataAccessGateway:
1814
1787
  """Internal method that performs a search on a given provider.
1815
1788
 
1816
1789
  :param search_plugin: A search plugin
1817
- :type search_plugin: eodag.plugins.base.Search
1818
1790
  :param count: (optional) Whether to run a query with a count request or not
1819
- :type count: bool
1820
1791
  :param raise_errors: (optional) When an error occurs when searching, if this is set to
1821
1792
  True, the error is raised
1822
- :type raise_errors: bool
1823
1793
  :param kwargs: Some other criteria that will be used to do the search
1824
- :type kwargs: Any
1825
1794
  :returns: A collection of EO products matching the criteria
1826
- :rtype: tuple(:class:`~eodag.api.search_result.SearchResult`, int or None)
1827
1795
  """
1828
1796
  max_items_per_page = getattr(search_plugin.config, "pagination", {}).get(
1829
1797
  "max_items_per_page", DEFAULT_MAX_ITEMS_PER_PAGE
@@ -1881,6 +1849,7 @@ class EODataAccessGateway:
1881
1849
  pattern = re.compile(r"[^\w,]+")
1882
1850
  try:
1883
1851
  guesses = self.guess_product_type(
1852
+ intersect=False,
1884
1853
  **{
1885
1854
  k: pattern.sub("", str(v).upper())
1886
1855
  for k, v in eo_product.properties.items()
@@ -1894,7 +1863,7 @@ class EODataAccessGateway:
1894
1863
  "keywords",
1895
1864
  ]
1896
1865
  and v is not None
1897
- }
1866
+ },
1898
1867
  )
1899
1868
  except NoMatchingProductType:
1900
1869
  pass
@@ -1965,9 +1934,7 @@ class EODataAccessGateway:
1965
1934
  """Apply the filters given through the keyword arguments to the results
1966
1935
 
1967
1936
  :param results: The results of a eodag search request
1968
- :type results: :class:`~eodag.api.search_result.SearchResult`
1969
1937
  :returns: The result of successively applying all the filters to the results
1970
- :rtype: :class:`~eodag.api.search_result.SearchResult`
1971
1938
  """
1972
1939
  search_criteria = kwargs.pop("search_criteria", {})
1973
1940
  for cruncher_name, cruncher_args in kwargs.items():
@@ -1983,7 +1950,6 @@ class EODataAccessGateway:
1983
1950
  by extent (i.e. bounding box).
1984
1951
 
1985
1952
  :param searches: List of eodag SearchResult
1986
- :type searches: list
1987
1953
  :returns: list of :class:`~eodag.api.search_result.SearchResult`
1988
1954
  """
1989
1955
  # Dict with extents as keys, each extent being defined by a str
@@ -2014,33 +1980,32 @@ class EODataAccessGateway:
2014
1980
  """Download all products resulting from a search.
2015
1981
 
2016
1982
  :param search_result: A collection of EO products resulting from a search
2017
- :type search_result: :class:`~eodag.api.search_result.SearchResult`
2018
1983
  :param downloaded_callback: (optional) A method or a callable object which takes
2019
1984
  as parameter the ``product``. You can use the base class
2020
1985
  :class:`~eodag.api.product.DownloadedCallback` and override
2021
1986
  its ``__call__`` method. Will be called each time a product
2022
1987
  finishes downloading
2023
- :type downloaded_callback: Callable[[:class:`~eodag.api.product._product.EOProduct`], None]
2024
- or None
2025
1988
  :param progress_callback: (optional) A method or a callable object
2026
1989
  which takes a current size and a maximum
2027
1990
  size as inputs and handle progress bar
2028
1991
  creation and update to give the user a
2029
1992
  feedback on the download progress
2030
- :type progress_callback: :class:`~eodag.utils.ProgressCallback` or None
2031
1993
  :param wait: (optional) If download fails, wait time in minutes between
2032
1994
  two download tries of the same product
2033
- :type wait: int
2034
1995
  :param timeout: (optional) If download fails, maximum time in minutes
2035
1996
  before stop retrying to download
2036
- :type timeout: int
2037
- :param kwargs: `outputs_prefix` (str), `extract` (bool), `delete_archive` (bool)
2038
- and `dl_url_params` (dict) can be provided as additional kwargs
2039
- and will override any other values defined in a configuration
2040
- file or with environment variables.
2041
- :type kwargs: Union[str, bool, dict]
1997
+ :param kwargs: Additional keyword arguments from the download plugin configuration class that can
1998
+ be provided to override any other values defined in a configuration file
1999
+ or with environment variables:
2000
+
2001
+ * ``output_dir`` - where to store downloaded products, as an absolute file path
2002
+ (Default: local temporary directory)
2003
+ * ``output_extension`` - downloaded file extension
2004
+ * ``extract`` - whether to extract the downloaded products, only applies to archived products
2005
+ * ``dl_url_params`` - additional parameters to pass over to the download url as an url parameter
2006
+ * ``delete_archive`` - whether to delete the downloaded archives
2007
+ * ``asset`` - regex filter to identify assets to download
2042
2008
  :returns: A collection of the absolute paths to the downloaded products
2043
- :rtype: list
2044
2009
  """
2045
2010
  paths = []
2046
2011
  if search_result:
@@ -2069,11 +2034,8 @@ class EODataAccessGateway:
2069
2034
  """Registers results of a search into a geojson file.
2070
2035
 
2071
2036
  :param search_result: A collection of EO products resulting from a search
2072
- :type search_result: :class:`~eodag.api.search_result.SearchResult`
2073
2037
  :param filename: (optional) The name of the file to generate
2074
- :type filename: str
2075
2038
  :returns: The name of the created file
2076
- :rtype: str
2077
2039
  """
2078
2040
  with open(filename, "w") as fh:
2079
2041
  geojson.dump(search_result, fh)
@@ -2084,9 +2046,7 @@ class EODataAccessGateway:
2084
2046
  """Loads results of a search from a geojson file.
2085
2047
 
2086
2048
  :param filename: A filename containing a search result encoded as a geojson
2087
- :type filename: str
2088
2049
  :returns: The search results encoded in `filename`
2089
- :rtype: :class:`~eodag.api.search_result.SearchResult`
2090
2050
  """
2091
2051
  with open(filename, "r") as fh:
2092
2052
  return SearchResult.from_geojson(geojson.load(fh))
@@ -2096,9 +2056,7 @@ class EODataAccessGateway:
2096
2056
  products with the information needed to download itself
2097
2057
 
2098
2058
  :param filename: A filename containing a search result encoded as a geojson
2099
- :type filename: str
2100
2059
  :returns: The search results encoded in `filename`
2101
- :rtype: :class:`~eodag.api.search_result.SearchResult`
2102
2060
  """
2103
2061
  products = self.deserialize(filename)
2104
2062
  for i, product in enumerate(products):
@@ -2131,22 +2089,14 @@ class EODataAccessGateway:
2131
2089
  the response content to an API request.
2132
2090
 
2133
2091
  :param filename: A filename containing features encoded as a geojson
2134
- :type filename: str
2135
2092
  :param recursive: (optional) Browse recursively in child nodes if True
2136
- :type recursive: bool
2137
2093
  :param max_connections: (optional) Maximum number of connections for HTTP requests
2138
- :type max_connections: int
2139
2094
  :param provider: (optional) Data provider
2140
- :type provider: str
2141
2095
  :param productType: (optional) Data product type
2142
- :type productType: str
2143
2096
  :param timeout: (optional) Timeout in seconds for each internal HTTP request
2144
- :type timeout: float
2145
2097
  :param kwargs: Parameters that will be stored in the result as
2146
2098
  search criteria
2147
- :type kwargs: Any
2148
2099
  :returns: The search results encoded in `filename`
2149
- :rtype: :class:`~eodag.api.search_result.SearchResult`
2150
2100
 
2151
2101
  .. deprecated:: 2.2.1
2152
2102
  Use the :class:`~eodag.plugins.search.static_stac_search.StaticStacSearch` search plugin instead.
@@ -2211,26 +2161,27 @@ class EODataAccessGateway:
2211
2161
  trying to download the product.
2212
2162
 
2213
2163
  :param product: The EO product to download
2214
- :type product: :class:`~eodag.api.product._product.EOProduct`
2215
2164
  :param progress_callback: (optional) A method or a callable object
2216
2165
  which takes a current size and a maximum
2217
2166
  size as inputs and handle progress bar
2218
2167
  creation and update to give the user a
2219
2168
  feedback on the download progress
2220
- :type progress_callback: :class:`~eodag.utils.ProgressCallback` or None
2221
2169
  :param wait: (optional) If download fails, wait time in minutes between
2222
2170
  two download tries
2223
- :type wait: int
2224
2171
  :param timeout: (optional) If download fails, maximum time in minutes
2225
2172
  before stop retrying to download
2226
- :type timeout: int
2227
- :param kwargs: `outputs_prefix` (str), `extract` (bool), `delete_archive` (bool)
2228
- and `dl_url_params` (dict) can be provided as additional kwargs
2229
- and will override any other values defined in a configuration
2230
- file or with environment variables.
2231
- :type kwargs: Union[str, bool, dict]
2173
+ :param kwargs: Additional keyword arguments from the download plugin configuration class that can
2174
+ be provided to override any other values defined in a configuration file
2175
+ or with environment variables:
2176
+
2177
+ * ``output_dir`` - where to store downloaded products, as an absolute file path
2178
+ (Default: local temporary directory)
2179
+ * ``output_extension`` - downloaded file extension
2180
+ * ``extract`` - whether to extract the downloaded products, only applies to archived products
2181
+ * ``dl_url_params`` - additional parameters to pass over to the download url as an url parameter
2182
+ * ``delete_archive`` - whether to delete the downloaded archives
2183
+ * ``asset`` - regex filter to identify assets to download
2232
2184
  :returns: The absolute path to the downloaded product in the local filesystem
2233
- :rtype: str
2234
2185
  :raises: :class:`~eodag.utils.exceptions.PluginImplementationError`
2235
2186
  :raises: :class:`RuntimeError`
2236
2187
  """
@@ -2257,11 +2208,8 @@ class EODataAccessGateway:
2257
2208
  """Build a crunch plugin from a configuration
2258
2209
 
2259
2210
  :param name: The name of the cruncher to build
2260
- :type name: str
2261
2211
  :param options: The configuration options of the cruncher
2262
- :type options: dict
2263
2212
  :returns: The cruncher named ``name``
2264
- :rtype: :class:`~eodag.plugins.crunch.Crunch`
2265
2213
  """
2266
2214
  plugin_conf = {"name": name}
2267
2215
  plugin_conf.update({key.replace("-", "_"): val for key, val in options.items()})
@@ -2273,17 +2221,14 @@ class EODataAccessGateway:
2273
2221
  """Fetch the queryable properties for a given product type and/or provider.
2274
2222
 
2275
2223
  :param provider: (optional) The provider.
2276
- :type provider: str
2277
2224
  :param kwargs: additional filters for queryables (`productType` or other search
2278
2225
  arguments)
2279
- :type kwargs: Any
2280
2226
 
2281
2227
  :raises UnsupportedProductType: If the specified product type is not available for the
2282
2228
  provider.
2283
2229
 
2284
2230
  :returns: A dict containing the EODAG queryable properties, associating
2285
2231
  parameters to their annotated type
2286
- :rtype: Dict[str, Annotated[Any, FieldInfo]]
2287
2232
  """
2288
2233
  available_product_types = [
2289
2234
  pt["ID"]
@@ -2341,7 +2286,6 @@ class EODataAccessGateway:
2341
2286
 
2342
2287
  :returns: A dictionnary with providers as keys and dictionnary of sortable parameter(s) and
2343
2288
  its (their) maximum number as value(s).
2344
- :rtype: dict
2345
2289
  :raises: :class:`~eodag.utils.exceptions.UnsupportedProvider`
2346
2290
  """
2347
2291
  sortables: Dict[str, Optional[ProviderSortables]] = {}