eodag 3.6.0__py3-none-any.whl → 3.7.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.
- eodag/api/core.py +0 -14
- eodag/api/product/metadata_mapping.py +20 -3
- eodag/cli.py +6 -3
- eodag/config.py +5 -0
- eodag/plugins/authentication/openid_connect.py +1 -2
- eodag/plugins/download/aws.py +145 -178
- eodag/plugins/download/base.py +3 -2
- eodag/plugins/download/creodias_s3.py +10 -5
- eodag/plugins/download/http.py +14 -6
- eodag/plugins/download/s3rest.py +1 -2
- eodag/plugins/manager.py +1 -1
- eodag/plugins/search/base.py +34 -4
- eodag/plugins/search/build_search_result.py +3 -0
- eodag/plugins/search/cop_marine.py +2 -0
- eodag/plugins/search/qssearch.py +44 -25
- eodag/resources/ext_product_types.json +1 -1
- eodag/resources/product_types.yml +30 -153
- eodag/resources/providers.yml +48 -325
- eodag/resources/stac.yml +1 -2
- eodag/resources/user_conf_template.yml +0 -11
- eodag/rest/core.py +5 -9
- eodag/utils/__init__.py +41 -27
- eodag/utils/exceptions.py +4 -0
- eodag/utils/s3.py +605 -65
- {eodag-3.6.0.dist-info → eodag-3.7.0.dist-info}/METADATA +7 -8
- {eodag-3.6.0.dist-info → eodag-3.7.0.dist-info}/RECORD +30 -30
- {eodag-3.6.0.dist-info → eodag-3.7.0.dist-info}/WHEEL +0 -0
- {eodag-3.6.0.dist-info → eodag-3.7.0.dist-info}/entry_points.txt +0 -0
- {eodag-3.6.0.dist-info → eodag-3.7.0.dist-info}/licenses/LICENSE +0 -0
- {eodag-3.6.0.dist-info → eodag-3.7.0.dist-info}/top_level.txt +0 -0
eodag/utils/__init__.py
CHANGED
|
@@ -36,6 +36,7 @@ import re
|
|
|
36
36
|
import shutil
|
|
37
37
|
import ssl
|
|
38
38
|
import string
|
|
39
|
+
import struct
|
|
39
40
|
import sys
|
|
40
41
|
import types
|
|
41
42
|
import unicodedata
|
|
@@ -61,18 +62,7 @@ from typing import (
|
|
|
61
62
|
Union,
|
|
62
63
|
cast,
|
|
63
64
|
)
|
|
64
|
-
|
|
65
|
-
# All modules using these should import them from utils package
|
|
66
|
-
from urllib.parse import ( # noqa; noqa
|
|
67
|
-
parse_qs,
|
|
68
|
-
parse_qsl,
|
|
69
|
-
quote,
|
|
70
|
-
unquote,
|
|
71
|
-
urlencode,
|
|
72
|
-
urljoin,
|
|
73
|
-
urlparse,
|
|
74
|
-
urlsplit,
|
|
75
|
-
)
|
|
65
|
+
from urllib.parse import urlparse, urlsplit
|
|
76
66
|
from urllib.request import url2pathname
|
|
77
67
|
|
|
78
68
|
if sys.version_info >= (3, 12):
|
|
@@ -80,7 +70,6 @@ if sys.version_info >= (3, 12):
|
|
|
80
70
|
else:
|
|
81
71
|
from typing_extensions import Unpack # noqa
|
|
82
72
|
|
|
83
|
-
|
|
84
73
|
import click
|
|
85
74
|
import orjson
|
|
86
75
|
import shapefile
|
|
@@ -224,14 +213,13 @@ class FloatRange(click.types.FloatParamType):
|
|
|
224
213
|
):
|
|
225
214
|
if self.min is None:
|
|
226
215
|
self.fail(
|
|
227
|
-
"%s is bigger than the maximum valid value
|
|
216
|
+
"%s is bigger than the maximum valid value %s." % (rv, self.max),
|
|
228
217
|
param,
|
|
229
218
|
ctx,
|
|
230
219
|
)
|
|
231
220
|
elif self.max is None:
|
|
232
221
|
self.fail(
|
|
233
|
-
"%s is smaller than the minimum valid value "
|
|
234
|
-
"%s." % (rv, self.min),
|
|
222
|
+
"%s is smaller than the minimum valid value %s." % (rv, self.min),
|
|
235
223
|
param,
|
|
236
224
|
ctx,
|
|
237
225
|
)
|
|
@@ -387,27 +375,29 @@ def merge_mappings(mapping1: dict[Any, Any], mapping2: dict[Any, Any]) -> None:
|
|
|
387
375
|
# `m1_keys_lowercase.get(key, key)`
|
|
388
376
|
current_value = mapping1.get(m1_keys_lowercase.get(key, key))
|
|
389
377
|
if current_value is not None:
|
|
390
|
-
current_value_type = type(current_value)
|
|
391
|
-
new_value_type = type(value)
|
|
392
378
|
try:
|
|
393
379
|
# If current or new value is a list (search queryable parameter), simply replace current with new
|
|
394
380
|
if (
|
|
395
|
-
|
|
396
|
-
and
|
|
397
|
-
or
|
|
398
|
-
and
|
|
381
|
+
isinstance(value, list)
|
|
382
|
+
and not isinstance(current_value, list)
|
|
383
|
+
or not isinstance(value, list)
|
|
384
|
+
and isinstance(current_value, list)
|
|
399
385
|
):
|
|
400
386
|
mapping1[m1_keys_lowercase.get(key, key)] = value
|
|
401
387
|
else:
|
|
402
388
|
mapping1[m1_keys_lowercase.get(key, key)] = cast_scalar_value(
|
|
403
|
-
value,
|
|
389
|
+
value, type(current_value)
|
|
404
390
|
)
|
|
405
391
|
except (TypeError, ValueError):
|
|
406
392
|
# Ignore any override value that does not have the same type
|
|
407
393
|
# as the default value
|
|
408
394
|
logger.debug(
|
|
409
|
-
|
|
410
|
-
|
|
395
|
+
"Ignored '%s' setting override from '%s' to '%s', (could not cast %s to %s)",
|
|
396
|
+
key,
|
|
397
|
+
current_value,
|
|
398
|
+
value,
|
|
399
|
+
type(value),
|
|
400
|
+
type(current_value),
|
|
411
401
|
)
|
|
412
402
|
pass
|
|
413
403
|
else:
|
|
@@ -1451,8 +1441,7 @@ def cast_scalar_value(value: Any, new_type: Any) -> Any:
|
|
|
1451
1441
|
# case
|
|
1452
1442
|
if value.capitalize() not in ("True", "False"):
|
|
1453
1443
|
raise ValueError(
|
|
1454
|
-
"Only true or false strings (case insensitive) are "
|
|
1455
|
-
"allowed for booleans"
|
|
1444
|
+
"Only true or false strings (case insensitive) are allowed for booleans"
|
|
1456
1445
|
)
|
|
1457
1446
|
# Get the real Python value of the boolean. e.g: value='tRuE'
|
|
1458
1447
|
# => eval(value.capitalize())=True.
|
|
@@ -1505,6 +1494,7 @@ def guess_extension(type: str) -> Optional[str]:
|
|
|
1505
1494
|
return mimetypes.guess_extension(type, strict=False)
|
|
1506
1495
|
|
|
1507
1496
|
|
|
1497
|
+
@functools.lru_cache(maxsize=2)
|
|
1508
1498
|
def get_ssl_context(ssl_verify: bool) -> ssl.SSLContext:
|
|
1509
1499
|
"""
|
|
1510
1500
|
Returns an SSL context based on ``ssl_verify`` argument.
|
|
@@ -1572,3 +1562,27 @@ def remove_str_array_quotes(input_str: str) -> str:
|
|
|
1572
1562
|
continue
|
|
1573
1563
|
output_str += input_str[i]
|
|
1574
1564
|
return output_str
|
|
1565
|
+
|
|
1566
|
+
|
|
1567
|
+
def parse_le_uint32(data: bytes) -> int:
|
|
1568
|
+
"""
|
|
1569
|
+
Parse little-endian unsigned 4-byte integer.
|
|
1570
|
+
|
|
1571
|
+
>>> parse_le_uint32(b'\\x01\\x00\\x00\\x00')
|
|
1572
|
+
1
|
|
1573
|
+
>>> parse_le_uint32(b'\\xff\\xff\\xff\\xff')
|
|
1574
|
+
4294967295
|
|
1575
|
+
"""
|
|
1576
|
+
return struct.unpack("<I", data)[0]
|
|
1577
|
+
|
|
1578
|
+
|
|
1579
|
+
def parse_le_uint16(data: bytes) -> int:
|
|
1580
|
+
"""
|
|
1581
|
+
Parse little-endian unsigned 2-byte integer.
|
|
1582
|
+
|
|
1583
|
+
>>> parse_le_uint16(b'\\x01\\x00')
|
|
1584
|
+
1
|
|
1585
|
+
>>> parse_le_uint16(b'\\xff\\xff')
|
|
1586
|
+
65535
|
|
1587
|
+
"""
|
|
1588
|
+
return struct.unpack("<H", data)[0]
|
eodag/utils/exceptions.py
CHANGED
|
@@ -79,6 +79,10 @@ class STACOpenerError(EodagError):
|
|
|
79
79
|
"""An error indicating that a STAC file could not be opened"""
|
|
80
80
|
|
|
81
81
|
|
|
82
|
+
class InvalidDataError(EodagError):
|
|
83
|
+
"""Raised when data is invalid, malformed, or corrupt and cannot be processed as expected."""
|
|
84
|
+
|
|
85
|
+
|
|
82
86
|
class RequestError(EodagError):
|
|
83
87
|
"""An error indicating that a request has failed. Usually eodag functions
|
|
84
88
|
and methods should catch and skip this"""
|