eodag 3.1.0b1__py3-none-any.whl → 3.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. eodag/api/core.py +69 -63
  2. eodag/api/product/_assets.py +49 -13
  3. eodag/api/product/_product.py +41 -30
  4. eodag/api/product/drivers/__init__.py +81 -4
  5. eodag/api/product/drivers/base.py +65 -4
  6. eodag/api/product/drivers/generic.py +65 -0
  7. eodag/api/product/drivers/sentinel1.py +97 -0
  8. eodag/api/product/drivers/sentinel2.py +95 -0
  9. eodag/api/product/metadata_mapping.py +85 -79
  10. eodag/api/search_result.py +13 -23
  11. eodag/cli.py +4 -4
  12. eodag/config.py +77 -80
  13. eodag/plugins/apis/base.py +1 -1
  14. eodag/plugins/apis/ecmwf.py +12 -15
  15. eodag/plugins/apis/usgs.py +12 -11
  16. eodag/plugins/authentication/aws_auth.py +16 -13
  17. eodag/plugins/authentication/base.py +5 -3
  18. eodag/plugins/authentication/header.py +3 -3
  19. eodag/plugins/authentication/keycloak.py +4 -4
  20. eodag/plugins/authentication/oauth.py +7 -3
  21. eodag/plugins/authentication/openid_connect.py +20 -14
  22. eodag/plugins/authentication/sas_auth.py +4 -4
  23. eodag/plugins/authentication/token.py +7 -7
  24. eodag/plugins/authentication/token_exchange.py +1 -1
  25. eodag/plugins/base.py +4 -4
  26. eodag/plugins/crunch/base.py +4 -4
  27. eodag/plugins/crunch/filter_date.py +4 -4
  28. eodag/plugins/crunch/filter_latest_intersect.py +6 -6
  29. eodag/plugins/crunch/filter_latest_tpl_name.py +7 -7
  30. eodag/plugins/crunch/filter_overlap.py +4 -4
  31. eodag/plugins/crunch/filter_property.py +4 -4
  32. eodag/plugins/download/aws.py +137 -77
  33. eodag/plugins/download/base.py +8 -17
  34. eodag/plugins/download/creodias_s3.py +2 -2
  35. eodag/plugins/download/http.py +30 -32
  36. eodag/plugins/download/s3rest.py +5 -4
  37. eodag/plugins/manager.py +10 -20
  38. eodag/plugins/search/__init__.py +6 -5
  39. eodag/plugins/search/base.py +38 -42
  40. eodag/plugins/search/build_search_result.py +286 -336
  41. eodag/plugins/search/cop_marine.py +22 -12
  42. eodag/plugins/search/creodias_s3.py +8 -78
  43. eodag/plugins/search/csw.py +11 -11
  44. eodag/plugins/search/data_request_search.py +19 -18
  45. eodag/plugins/search/qssearch.py +84 -151
  46. eodag/plugins/search/stac_list_assets.py +85 -0
  47. eodag/plugins/search/static_stac_search.py +4 -4
  48. eodag/resources/ext_product_types.json +1 -1
  49. eodag/resources/product_types.yml +848 -398
  50. eodag/resources/providers.yml +1038 -1115
  51. eodag/resources/stac_api.yml +2 -2
  52. eodag/resources/user_conf_template.yml +10 -9
  53. eodag/rest/cache.py +2 -2
  54. eodag/rest/config.py +3 -3
  55. eodag/rest/core.py +24 -24
  56. eodag/rest/errors.py +5 -5
  57. eodag/rest/server.py +3 -11
  58. eodag/rest/stac.py +41 -38
  59. eodag/rest/types/collections_search.py +3 -3
  60. eodag/rest/types/eodag_search.py +23 -23
  61. eodag/rest/types/queryables.py +40 -28
  62. eodag/rest/types/stac_search.py +15 -25
  63. eodag/rest/utils/__init__.py +11 -21
  64. eodag/rest/utils/cql_evaluate.py +6 -6
  65. eodag/rest/utils/rfc3339.py +2 -2
  66. eodag/types/__init__.py +97 -29
  67. eodag/types/bbox.py +2 -2
  68. eodag/types/download_args.py +2 -2
  69. eodag/types/queryables.py +5 -2
  70. eodag/types/search_args.py +4 -4
  71. eodag/types/whoosh.py +1 -3
  72. eodag/utils/__init__.py +82 -41
  73. eodag/utils/exceptions.py +2 -2
  74. eodag/utils/import_system.py +2 -2
  75. eodag/utils/requests.py +2 -2
  76. eodag/utils/rest.py +2 -2
  77. eodag/utils/s3.py +231 -0
  78. eodag/utils/stac_reader.py +10 -10
  79. {eodag-3.1.0b1.dist-info → eodag-3.2.0.dist-info}/METADATA +12 -10
  80. eodag-3.2.0.dist-info/RECORD +113 -0
  81. {eodag-3.1.0b1.dist-info → eodag-3.2.0.dist-info}/WHEEL +1 -1
  82. {eodag-3.1.0b1.dist-info → eodag-3.2.0.dist-info}/entry_points.txt +1 -0
  83. eodag-3.1.0b1.dist-info/RECORD +0 -108
  84. {eodag-3.1.0b1.dist-info → eodag-3.2.0.dist-info/licenses}/LICENSE +0 -0
  85. {eodag-3.1.0b1.dist-info → eodag-3.2.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,85 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2024, CS GROUP - France, https://www.csgroup.eu/
3
+ #
4
+ # This file is part of EODAG project
5
+ # https://www.github.com/CS-SI/EODAG
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ import logging
19
+ from types import MethodType
20
+ from typing import Any, List
21
+
22
+ from botocore.exceptions import BotoCoreError
23
+
24
+ from eodag.api.product import EOProduct # type: ignore
25
+ from eodag.api.search_result import RawSearchResult
26
+ from eodag.plugins.search.qssearch import StacSearch
27
+ from eodag.utils.exceptions import RequestError
28
+ from eodag.utils.s3 import update_assets_from_s3
29
+
30
+ logger = logging.getLogger("eodag.search.stac_list_assets")
31
+
32
+
33
+ def patched_register_downloader(self, downloader, authenticator):
34
+ """Add the download information to the product.
35
+
36
+ :param self: product to which information should be added
37
+ :param downloader: The download method that it can use
38
+ :class:`~eodag.plugins.download.base.Download` or
39
+ :class:`~eodag.plugins.api.base.Api`
40
+ :param authenticator: The authentication method needed to perform the download
41
+ :class:`~eodag.plugins.authentication.base.Authentication`
42
+ """
43
+ # register downloader
44
+ self.register_downloader_only(downloader, authenticator)
45
+ # and also update assets
46
+ try:
47
+ update_assets_from_s3(
48
+ self, authenticator, getattr(downloader.config, "s3_endpoint", None)
49
+ )
50
+ except BotoCoreError as e:
51
+ raise RequestError.from_error(e, "could not update assets") from e
52
+
53
+
54
+ class StacListAssets(StacSearch):
55
+ """``StacListAssets`` is an extension of :class:`~eodag.plugins.search.qssearch.StacSearch`.
56
+
57
+ It executes a Search on given STAC API endpoint and updates assets with content listed by the plugin using
58
+ ``downloadLink`` :class:`~eodag.api.product._product.EOProduct` property.
59
+
60
+ :param provider: provider name
61
+ :param config: It has the same Search plugin configuration as :class:`~eodag.plugins.search.qssearch.StacSearch` and
62
+ one additional parameter:
63
+
64
+ * :attr:`~eodag.config.PluginConfig.s3_endpoint` (``str``): s3 endpoint if not hosted on AWS
65
+ """
66
+
67
+ def __init__(self, provider, config):
68
+ super(StacSearch, self).__init__(provider, config)
69
+
70
+ def normalize_results(
71
+ self, results: RawSearchResult, **kwargs: Any
72
+ ) -> List[EOProduct]:
73
+ """Build EOProducts from provider results"""
74
+
75
+ products = super(StacSearch, self).normalize_results(results, **kwargs)
76
+
77
+ for product in products:
78
+ # backup original register_downloader to register_downloader_only
79
+ product.register_downloader_only = product.register_downloader
80
+ # patched register_downloader that will also update assets
81
+ product.register_downloader = MethodType(
82
+ patched_register_downloader, product
83
+ )
84
+
85
+ return products
@@ -18,7 +18,7 @@
18
18
  from __future__ import annotations
19
19
 
20
20
  import logging
21
- from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
21
+ from typing import TYPE_CHECKING, Any, Optional
22
22
  from unittest import mock
23
23
 
24
24
  import geojson
@@ -90,7 +90,7 @@ class StaticStacSearch(StacSearch):
90
90
  ):
91
91
  self.config.discover_product_types = {}
92
92
 
93
- def discover_product_types(self, **kwargs: Any) -> Optional[Dict[str, Any]]:
93
+ def discover_product_types(self, **kwargs: Any) -> Optional[dict[str, Any]]:
94
94
  """Fetch product types list from a static STAC Catalog provider using `discover_product_types` conf
95
95
 
96
96
  :returns: configuration dict containing fetched product types information
@@ -127,7 +127,7 @@ class StaticStacSearch(StacSearch):
127
127
  self,
128
128
  prep: PreparedSearch = PreparedSearch(),
129
129
  **kwargs: Any,
130
- ) -> Tuple[List[EOProduct], Optional[int]]:
130
+ ) -> tuple[list[EOProduct], Optional[int]]:
131
131
  """Perform a search on a static STAC Catalog"""
132
132
 
133
133
  # only return 1 page if pagination is disabled
@@ -142,7 +142,7 @@ class StaticStacSearch(StacSearch):
142
142
  product_type = kwargs.get("productType", prep.product_type)
143
143
  # provider product type specific conf
144
144
  self.product_type_def_params = (
145
- self.get_product_type_def_params(product_type, **kwargs)
145
+ self.get_product_type_def_params(product_type, format_variables=kwargs)
146
146
  if product_type is not None
147
147
  else {}
148
148
  )