eodag 3.0.0b1__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 (66) hide show
  1. eodag/__init__.py +6 -8
  2. eodag/api/core.py +119 -171
  3. eodag/api/product/__init__.py +10 -4
  4. eodag/api/product/_assets.py +52 -14
  5. eodag/api/product/_product.py +59 -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 +31 -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 +6 -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/repr.py +113 -0
  57. eodag/utils/requests.py +12 -20
  58. eodag/utils/rest.py +0 -4
  59. eodag/utils/stac_reader.py +2 -14
  60. {eodag-3.0.0b1.dist-info → eodag-3.0.0b3.dist-info}/METADATA +33 -14
  61. eodag-3.0.0b3.dist-info/RECORD +110 -0
  62. {eodag-3.0.0b1.dist-info → eodag-3.0.0b3.dist-info}/WHEEL +1 -1
  63. eodag-3.0.0b1.dist-info/RECORD +0 -109
  64. {eodag-3.0.0b1.dist-info → eodag-3.0.0b3.dist-info}/LICENSE +0 -0
  65. {eodag-3.0.0b1.dist-info → eodag-3.0.0b3.dist-info}/entry_points.txt +0 -0
  66. {eodag-3.0.0b1.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.
@@ -1445,8 +1428,12 @@ class EODataAccessGateway:
1445
1428
  start=start, end=end, geom=geom, locations=locations, **kwargs
1446
1429
  )
1447
1430
  for i, search_plugin in enumerate(search_plugins):
1448
- itp = items_per_page or search_plugin.config.pagination.get(
1449
- "max_items_per_page", DEFAULT_MAX_ITEMS_PER_PAGE
1431
+ itp = (
1432
+ items_per_page
1433
+ or getattr(search_plugin.config, "pagination", {}).get(
1434
+ "max_items_per_page"
1435
+ )
1436
+ or DEFAULT_MAX_ITEMS_PER_PAGE
1450
1437
  )
1451
1438
  logger.debug(
1452
1439
  "Searching for all the products with provider %s and a maximum of %s "
@@ -1505,15 +1492,11 @@ class EODataAccessGateway:
1505
1492
  perform the search, if this information is available
1506
1493
 
1507
1494
  :param uid: The uid of the EO product
1508
- :type uid: str
1509
1495
  :param provider: (optional) The provider on which to search the product.
1510
1496
  This may be useful for performance reasons when the user
1511
1497
  knows this product is available on the given provider
1512
- :type provider: str
1513
1498
  :param kwargs: Search criteria to help finding the right product
1514
- :type kwargs: Any
1515
1499
  :returns: A search result with one EO product or None at all
1516
- :rtype: :class:`~eodag.api.search_result.SearchResult`
1517
1500
  """
1518
1501
  product_type = kwargs.get("productType", None)
1519
1502
  if product_type is not None:
@@ -1593,6 +1576,10 @@ class EODataAccessGateway:
1593
1576
  plugins = self._plugins_manager.get_search_plugins(provider=provider)
1594
1577
  plugin = next(plugins)
1595
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
+
1596
1583
  kwargs: Dict[str, Any] = {"productType": product_type}
1597
1584
 
1598
1585
  # append auth if needed
@@ -1637,25 +1624,18 @@ class EODataAccessGateway:
1637
1624
  :param start: (optional) Start sensing time in ISO 8601 format (e.g. "1990-11-26",
1638
1625
  "1990-11-26T14:30:10.153Z", "1990-11-26T14:30:10+02:00", ...).
1639
1626
  If no time offset is given, the time is assumed to be given in UTC.
1640
- :type start: str
1641
1627
  :param end: (optional) End sensing time in ISO 8601 format (e.g. "1990-11-26",
1642
1628
  "1990-11-26T14:30:10.153Z", "1990-11-26T14:30:10+02:00", ...).
1643
1629
  If no time offset is given, the time is assumed to be given in UTC.
1644
- :type end: str
1645
1630
  :param geom: (optional) Search area that can be defined in different ways (see search)
1646
- :type geom: Union[str, dict, shapely.geometry.base.BaseGeometry]
1647
1631
  :param locations: (optional) Location filtering by name using locations configuration
1648
- :type locations: dict
1649
1632
  :param provider: provider to be used, if no provider is given or the product type
1650
1633
  is not available for the provider, the preferred provider is used
1651
- :type provider: str
1652
1634
  :param kwargs: Some other criteria
1653
1635
  * id and/or a provider for a search by
1654
1636
  * search criteria to guess the product type
1655
1637
  * other criteria compatible with the provider
1656
- :type kwargs: Any
1657
1638
  :returns: Search plugins list and the prepared kwargs to make a query.
1658
- :rtype: tuple(list, dict)
1659
1639
  """
1660
1640
  product_type = kwargs.get("productType", None)
1661
1641
  if product_type is None:
@@ -1721,18 +1701,15 @@ class EODataAccessGateway:
1721
1701
  product_type
1722
1702
  not in self._plugins_manager.product_type_to_provider_config_map.keys()
1723
1703
  ):
1724
- logger.debug(
1725
- f"Fetching external product types sources to find {product_type} product type"
1726
- )
1727
1704
  if provider:
1728
1705
  # Try to get specific product type from external provider
1706
+ logger.debug(f"Fetching {provider} to find {product_type} product type")
1729
1707
  self._fetch_external_product_type(provider, product_type)
1730
- if (
1731
- not provider
1732
- or product_type
1733
- not in self._plugins_manager.product_type_to_provider_config_map.keys()
1734
- ):
1708
+ if not provider:
1735
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
+ )
1736
1713
  self.fetch_product_types_list()
1737
1714
 
1738
1715
  preferred_provider = self.get_preferred_provider()[0]
@@ -1810,16 +1787,11 @@ class EODataAccessGateway:
1810
1787
  """Internal method that performs a search on a given provider.
1811
1788
 
1812
1789
  :param search_plugin: A search plugin
1813
- :type search_plugin: eodag.plugins.base.Search
1814
1790
  :param count: (optional) Whether to run a query with a count request or not
1815
- :type count: bool
1816
1791
  :param raise_errors: (optional) When an error occurs when searching, if this is set to
1817
1792
  True, the error is raised
1818
- :type raise_errors: bool
1819
1793
  :param kwargs: Some other criteria that will be used to do the search
1820
- :type kwargs: Any
1821
1794
  :returns: A collection of EO products matching the criteria
1822
- :rtype: tuple(:class:`~eodag.api.search_result.SearchResult`, int or None)
1823
1795
  """
1824
1796
  max_items_per_page = getattr(search_plugin.config, "pagination", {}).get(
1825
1797
  "max_items_per_page", DEFAULT_MAX_ITEMS_PER_PAGE
@@ -1877,6 +1849,7 @@ class EODataAccessGateway:
1877
1849
  pattern = re.compile(r"[^\w,]+")
1878
1850
  try:
1879
1851
  guesses = self.guess_product_type(
1852
+ intersect=False,
1880
1853
  **{
1881
1854
  k: pattern.sub("", str(v).upper())
1882
1855
  for k, v in eo_product.properties.items()
@@ -1890,7 +1863,7 @@ class EODataAccessGateway:
1890
1863
  "keywords",
1891
1864
  ]
1892
1865
  and v is not None
1893
- }
1866
+ },
1894
1867
  )
1895
1868
  except NoMatchingProductType:
1896
1869
  pass
@@ -1961,9 +1934,7 @@ class EODataAccessGateway:
1961
1934
  """Apply the filters given through the keyword arguments to the results
1962
1935
 
1963
1936
  :param results: The results of a eodag search request
1964
- :type results: :class:`~eodag.api.search_result.SearchResult`
1965
1937
  :returns: The result of successively applying all the filters to the results
1966
- :rtype: :class:`~eodag.api.search_result.SearchResult`
1967
1938
  """
1968
1939
  search_criteria = kwargs.pop("search_criteria", {})
1969
1940
  for cruncher_name, cruncher_args in kwargs.items():
@@ -1979,7 +1950,6 @@ class EODataAccessGateway:
1979
1950
  by extent (i.e. bounding box).
1980
1951
 
1981
1952
  :param searches: List of eodag SearchResult
1982
- :type searches: list
1983
1953
  :returns: list of :class:`~eodag.api.search_result.SearchResult`
1984
1954
  """
1985
1955
  # Dict with extents as keys, each extent being defined by a str
@@ -2010,33 +1980,32 @@ class EODataAccessGateway:
2010
1980
  """Download all products resulting from a search.
2011
1981
 
2012
1982
  :param search_result: A collection of EO products resulting from a search
2013
- :type search_result: :class:`~eodag.api.search_result.SearchResult`
2014
1983
  :param downloaded_callback: (optional) A method or a callable object which takes
2015
1984
  as parameter the ``product``. You can use the base class
2016
1985
  :class:`~eodag.api.product.DownloadedCallback` and override
2017
1986
  its ``__call__`` method. Will be called each time a product
2018
1987
  finishes downloading
2019
- :type downloaded_callback: Callable[[:class:`~eodag.api.product._product.EOProduct`], None]
2020
- or None
2021
1988
  :param progress_callback: (optional) A method or a callable object
2022
1989
  which takes a current size and a maximum
2023
1990
  size as inputs and handle progress bar
2024
1991
  creation and update to give the user a
2025
1992
  feedback on the download progress
2026
- :type progress_callback: :class:`~eodag.utils.ProgressCallback` or None
2027
1993
  :param wait: (optional) If download fails, wait time in minutes between
2028
1994
  two download tries of the same product
2029
- :type wait: int
2030
1995
  :param timeout: (optional) If download fails, maximum time in minutes
2031
1996
  before stop retrying to download
2032
- :type timeout: int
2033
- :param kwargs: `outputs_prefix` (str), `extract` (bool), `delete_archive` (bool)
2034
- and `dl_url_params` (dict) can be provided as additional kwargs
2035
- and will override any other values defined in a configuration
2036
- file or with environment variables.
2037
- :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
2038
2008
  :returns: A collection of the absolute paths to the downloaded products
2039
- :rtype: list
2040
2009
  """
2041
2010
  paths = []
2042
2011
  if search_result:
@@ -2065,11 +2034,8 @@ class EODataAccessGateway:
2065
2034
  """Registers results of a search into a geojson file.
2066
2035
 
2067
2036
  :param search_result: A collection of EO products resulting from a search
2068
- :type search_result: :class:`~eodag.api.search_result.SearchResult`
2069
2037
  :param filename: (optional) The name of the file to generate
2070
- :type filename: str
2071
2038
  :returns: The name of the created file
2072
- :rtype: str
2073
2039
  """
2074
2040
  with open(filename, "w") as fh:
2075
2041
  geojson.dump(search_result, fh)
@@ -2080,9 +2046,7 @@ class EODataAccessGateway:
2080
2046
  """Loads results of a search from a geojson file.
2081
2047
 
2082
2048
  :param filename: A filename containing a search result encoded as a geojson
2083
- :type filename: str
2084
2049
  :returns: The search results encoded in `filename`
2085
- :rtype: :class:`~eodag.api.search_result.SearchResult`
2086
2050
  """
2087
2051
  with open(filename, "r") as fh:
2088
2052
  return SearchResult.from_geojson(geojson.load(fh))
@@ -2092,9 +2056,7 @@ class EODataAccessGateway:
2092
2056
  products with the information needed to download itself
2093
2057
 
2094
2058
  :param filename: A filename containing a search result encoded as a geojson
2095
- :type filename: str
2096
2059
  :returns: The search results encoded in `filename`
2097
- :rtype: :class:`~eodag.api.search_result.SearchResult`
2098
2060
  """
2099
2061
  products = self.deserialize(filename)
2100
2062
  for i, product in enumerate(products):
@@ -2127,22 +2089,14 @@ class EODataAccessGateway:
2127
2089
  the response content to an API request.
2128
2090
 
2129
2091
  :param filename: A filename containing features encoded as a geojson
2130
- :type filename: str
2131
2092
  :param recursive: (optional) Browse recursively in child nodes if True
2132
- :type recursive: bool
2133
2093
  :param max_connections: (optional) Maximum number of connections for HTTP requests
2134
- :type max_connections: int
2135
2094
  :param provider: (optional) Data provider
2136
- :type provider: str
2137
2095
  :param productType: (optional) Data product type
2138
- :type productType: str
2139
2096
  :param timeout: (optional) Timeout in seconds for each internal HTTP request
2140
- :type timeout: float
2141
2097
  :param kwargs: Parameters that will be stored in the result as
2142
2098
  search criteria
2143
- :type kwargs: Any
2144
2099
  :returns: The search results encoded in `filename`
2145
- :rtype: :class:`~eodag.api.search_result.SearchResult`
2146
2100
 
2147
2101
  .. deprecated:: 2.2.1
2148
2102
  Use the :class:`~eodag.plugins.search.static_stac_search.StaticStacSearch` search plugin instead.
@@ -2207,26 +2161,27 @@ class EODataAccessGateway:
2207
2161
  trying to download the product.
2208
2162
 
2209
2163
  :param product: The EO product to download
2210
- :type product: :class:`~eodag.api.product._product.EOProduct`
2211
2164
  :param progress_callback: (optional) A method or a callable object
2212
2165
  which takes a current size and a maximum
2213
2166
  size as inputs and handle progress bar
2214
2167
  creation and update to give the user a
2215
2168
  feedback on the download progress
2216
- :type progress_callback: :class:`~eodag.utils.ProgressCallback` or None
2217
2169
  :param wait: (optional) If download fails, wait time in minutes between
2218
2170
  two download tries
2219
- :type wait: int
2220
2171
  :param timeout: (optional) If download fails, maximum time in minutes
2221
2172
  before stop retrying to download
2222
- :type timeout: int
2223
- :param kwargs: `outputs_prefix` (str), `extract` (bool), `delete_archive` (bool)
2224
- and `dl_url_params` (dict) can be provided as additional kwargs
2225
- and will override any other values defined in a configuration
2226
- file or with environment variables.
2227
- :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
2228
2184
  :returns: The absolute path to the downloaded product in the local filesystem
2229
- :rtype: str
2230
2185
  :raises: :class:`~eodag.utils.exceptions.PluginImplementationError`
2231
2186
  :raises: :class:`RuntimeError`
2232
2187
  """
@@ -2253,11 +2208,8 @@ class EODataAccessGateway:
2253
2208
  """Build a crunch plugin from a configuration
2254
2209
 
2255
2210
  :param name: The name of the cruncher to build
2256
- :type name: str
2257
2211
  :param options: The configuration options of the cruncher
2258
- :type options: dict
2259
2212
  :returns: The cruncher named ``name``
2260
- :rtype: :class:`~eodag.plugins.crunch.Crunch`
2261
2213
  """
2262
2214
  plugin_conf = {"name": name}
2263
2215
  plugin_conf.update({key.replace("-", "_"): val for key, val in options.items()})
@@ -2269,17 +2221,14 @@ class EODataAccessGateway:
2269
2221
  """Fetch the queryable properties for a given product type and/or provider.
2270
2222
 
2271
2223
  :param provider: (optional) The provider.
2272
- :type provider: str
2273
2224
  :param kwargs: additional filters for queryables (`productType` or other search
2274
2225
  arguments)
2275
- :type kwargs: Any
2276
2226
 
2277
2227
  :raises UnsupportedProductType: If the specified product type is not available for the
2278
2228
  provider.
2279
2229
 
2280
2230
  :returns: A dict containing the EODAG queryable properties, associating
2281
2231
  parameters to their annotated type
2282
- :rtype: Dict[str, Annotated[Any, FieldInfo]]
2283
2232
  """
2284
2233
  available_product_types = [
2285
2234
  pt["ID"]
@@ -2337,7 +2286,6 @@ class EODataAccessGateway:
2337
2286
 
2338
2287
  :returns: A dictionnary with providers as keys and dictionnary of sortable parameter(s) and
2339
2288
  its (their) maximum number as value(s).
2340
- :rtype: dict
2341
2289
  :raises: :class:`~eodag.utils.exceptions.UnsupportedProvider`
2342
2290
  """
2343
2291
  sortables: Dict[str, Optional[ProviderSortables]] = {}