eodag 3.9.1__py3-none-any.whl → 4.0.0a1__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 +378 -419
- eodag/api/product/__init__.py +3 -3
- eodag/api/product/_product.py +68 -40
- eodag/api/product/drivers/__init__.py +3 -5
- eodag/api/product/drivers/base.py +1 -18
- eodag/api/product/metadata_mapping.py +151 -215
- eodag/api/search_result.py +13 -7
- eodag/cli.py +72 -395
- eodag/config.py +46 -50
- eodag/plugins/apis/base.py +2 -2
- eodag/plugins/apis/ecmwf.py +20 -21
- eodag/plugins/apis/usgs.py +37 -33
- eodag/plugins/authentication/aws_auth.py +36 -1
- eodag/plugins/authentication/base.py +18 -3
- eodag/plugins/authentication/sas_auth.py +15 -0
- eodag/plugins/crunch/filter_date.py +3 -3
- eodag/plugins/crunch/filter_latest_intersect.py +2 -2
- eodag/plugins/crunch/filter_latest_tpl_name.py +1 -1
- eodag/plugins/download/aws.py +45 -41
- eodag/plugins/download/base.py +13 -14
- eodag/plugins/download/http.py +65 -65
- eodag/plugins/manager.py +28 -29
- eodag/plugins/search/__init__.py +3 -4
- eodag/plugins/search/base.py +128 -77
- eodag/plugins/search/build_search_result.py +105 -107
- eodag/plugins/search/cop_marine.py +44 -47
- eodag/plugins/search/csw.py +33 -33
- eodag/plugins/search/qssearch.py +335 -354
- eodag/plugins/search/stac_list_assets.py +1 -1
- eodag/plugins/search/static_stac_search.py +31 -31
- eodag/resources/{product_types.yml → collections.yml} +2353 -2429
- eodag/resources/ext_collections.json +1 -0
- eodag/resources/ext_product_types.json +1 -1
- eodag/resources/providers.yml +2432 -2714
- eodag/resources/stac_provider.yml +46 -90
- eodag/types/queryables.py +55 -91
- eodag/types/search_args.py +1 -1
- eodag/utils/__init__.py +94 -21
- eodag/utils/exceptions.py +6 -6
- eodag/utils/free_text_search.py +3 -3
- {eodag-3.9.1.dist-info → eodag-4.0.0a1.dist-info}/METADATA +11 -88
- eodag-4.0.0a1.dist-info/RECORD +92 -0
- {eodag-3.9.1.dist-info → eodag-4.0.0a1.dist-info}/entry_points.txt +0 -4
- eodag/plugins/authentication/oauth.py +0 -60
- eodag/plugins/download/creodias_s3.py +0 -64
- eodag/plugins/download/s3rest.py +0 -351
- eodag/plugins/search/data_request_search.py +0 -565
- eodag/resources/stac.yml +0 -294
- eodag/resources/stac_api.yml +0 -2105
- eodag/rest/__init__.py +0 -24
- eodag/rest/cache.py +0 -70
- eodag/rest/config.py +0 -67
- eodag/rest/constants.py +0 -26
- eodag/rest/core.py +0 -764
- eodag/rest/errors.py +0 -210
- eodag/rest/server.py +0 -604
- eodag/rest/server.wsgi +0 -6
- eodag/rest/stac.py +0 -1032
- eodag/rest/templates/README +0 -1
- eodag/rest/types/__init__.py +0 -18
- eodag/rest/types/collections_search.py +0 -44
- eodag/rest/types/eodag_search.py +0 -386
- eodag/rest/types/queryables.py +0 -174
- eodag/rest/types/stac_search.py +0 -272
- eodag/rest/utils/__init__.py +0 -207
- eodag/rest/utils/cql_evaluate.py +0 -119
- eodag/rest/utils/rfc3339.py +0 -64
- eodag-3.9.1.dist-info/RECORD +0 -115
- {eodag-3.9.1.dist-info → eodag-4.0.0a1.dist-info}/WHEEL +0 -0
- {eodag-3.9.1.dist-info → eodag-4.0.0a1.dist-info}/licenses/LICENSE +0 -0
- {eodag-3.9.1.dist-info → eodag-4.0.0a1.dist-info}/top_level.txt +0 -0
eodag/rest/__init__.py
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Copyright 2018, 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
|
-
"""EODAG REST API"""
|
|
19
|
-
try:
|
|
20
|
-
from fastapi import __version__ # noqa: F401
|
|
21
|
-
except ImportError:
|
|
22
|
-
raise ImportError(
|
|
23
|
-
f"{__name__} not available, please install eodag[server] or eodag[all]"
|
|
24
|
-
)
|
eodag/rest/cache.py
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
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 typing import Any, Callable, Coroutine, TypeVar, cast
|
|
20
|
-
|
|
21
|
-
import orjson
|
|
22
|
-
from cachetools import LRUCache
|
|
23
|
-
from fastapi import FastAPI, Request
|
|
24
|
-
|
|
25
|
-
from eodag.rest.config import Settings
|
|
26
|
-
from eodag.utils import urlsplit
|
|
27
|
-
|
|
28
|
-
logger = logging.getLogger("eodag.rest.utils")
|
|
29
|
-
|
|
30
|
-
T = TypeVar("T")
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def init_cache(app: FastAPI) -> None:
|
|
34
|
-
"""Connect to local cache"""
|
|
35
|
-
settings = Settings.from_environment()
|
|
36
|
-
|
|
37
|
-
app.state.cache = LRUCache(maxsize=settings.cache_maxsize)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
async def cached(
|
|
41
|
-
fn: Callable[[], Coroutine[Any, Any, T]], cache_key: str, request: Request
|
|
42
|
-
) -> T:
|
|
43
|
-
"""Either get the result from local cache or run the function and cache the result."""
|
|
44
|
-
settings = Settings.from_environment()
|
|
45
|
-
|
|
46
|
-
host = urlsplit(cast(str, request.state.url_root)).netloc
|
|
47
|
-
|
|
48
|
-
host_cache_key = f"{cache_key}:{host}"
|
|
49
|
-
|
|
50
|
-
try:
|
|
51
|
-
c: dict[str, Any] = request.app.state.cache
|
|
52
|
-
|
|
53
|
-
if cached := c.get(host_cache_key):
|
|
54
|
-
logger.debug("Cache result hit")
|
|
55
|
-
return orjson.loads(cached) # type: ignore
|
|
56
|
-
except Exception as e:
|
|
57
|
-
logger.error(f"Error in cache: {e}")
|
|
58
|
-
if settings.debug:
|
|
59
|
-
raise
|
|
60
|
-
|
|
61
|
-
result = await fn()
|
|
62
|
-
|
|
63
|
-
try:
|
|
64
|
-
c[host_cache_key] = orjson.dumps(result) # type: ignore
|
|
65
|
-
except Exception as e:
|
|
66
|
-
logger.error(f"Error in cache: {e}")
|
|
67
|
-
if settings.debug:
|
|
68
|
-
raise
|
|
69
|
-
|
|
70
|
-
return result
|
eodag/rest/config.py
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
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
|
-
from __future__ import annotations
|
|
19
|
-
|
|
20
|
-
from functools import lru_cache
|
|
21
|
-
from typing import Annotated, Union
|
|
22
|
-
|
|
23
|
-
from pydantic import Field
|
|
24
|
-
from pydantic.functional_validators import BeforeValidator
|
|
25
|
-
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
26
|
-
from typing_extensions import Doc
|
|
27
|
-
|
|
28
|
-
from eodag.rest.constants import DEFAULT_MAXSIZE, DEFAULT_TTL
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def str2liststr(raw: Union[str, list[str]]) -> list[str]:
|
|
32
|
-
"""Convert str to list[str]"""
|
|
33
|
-
if isinstance(raw, list):
|
|
34
|
-
return raw
|
|
35
|
-
return raw.split(",")
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class Settings(BaseSettings):
|
|
39
|
-
"""EODAG Server config"""
|
|
40
|
-
|
|
41
|
-
# local cache config
|
|
42
|
-
cache_ttl: int = Field(default=DEFAULT_TTL)
|
|
43
|
-
cache_maxsize: int = Field(default=DEFAULT_MAXSIZE)
|
|
44
|
-
|
|
45
|
-
debug: bool = False
|
|
46
|
-
|
|
47
|
-
stac_api_title: str = "eodag-stac-api"
|
|
48
|
-
stac_api_description: str = "STAC API provided by EODAG"
|
|
49
|
-
stac_api_landing_id: str = "eodag-stac-api"
|
|
50
|
-
|
|
51
|
-
origin_url_blacklist: Annotated[
|
|
52
|
-
Union[str, list[str]],
|
|
53
|
-
BeforeValidator(str2liststr),
|
|
54
|
-
Doc(
|
|
55
|
-
"Hide from clients items assets' alternative URLs starting with URLs from the list"
|
|
56
|
-
),
|
|
57
|
-
] = Field(default=[])
|
|
58
|
-
|
|
59
|
-
model_config = SettingsConfigDict(
|
|
60
|
-
env_prefix="EODAG_", extra="ignore", env_nested_delimiter="__"
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
@classmethod
|
|
64
|
-
@lru_cache(maxsize=1)
|
|
65
|
-
def from_environment(cls) -> Settings:
|
|
66
|
-
"""Get settings"""
|
|
67
|
-
return Settings()
|
eodag/rest/constants.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
# default cache ttl
|
|
19
|
-
DEFAULT_TTL = 600 # 10 min
|
|
20
|
-
|
|
21
|
-
DEFAULT_MAXSIZE = 2048 # local cache maxsize
|
|
22
|
-
|
|
23
|
-
CACHE_KEY_COLLECTIONS = "collections"
|
|
24
|
-
CACHE_KEY_COLLECTION = "collection"
|
|
25
|
-
CACHE_KEY_SEARCH = "search"
|
|
26
|
-
CACHE_KEY_QUERYABLES = "queryables"
|