cdsetool 0.2.11__tar.gz → 0.2.12__tar.gz
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.
- {cdsetool-0.2.11/src/cdsetool.egg-info → cdsetool-0.2.12}/PKG-INFO +6 -6
- {cdsetool-0.2.11 → cdsetool-0.2.12}/README.md +1 -1
- {cdsetool-0.2.11 → cdsetool-0.2.12}/pyproject.toml +5 -5
- {cdsetool-0.2.11 → cdsetool-0.2.12}/src/cdsetool/cli.py +6 -2
- {cdsetool-0.2.11 → cdsetool-0.2.12}/src/cdsetool/credentials.py +1 -1
- {cdsetool-0.2.11 → cdsetool-0.2.12}/src/cdsetool/download.py +18 -7
- {cdsetool-0.2.11 → cdsetool-0.2.12}/src/cdsetool/query.py +1 -1
- {cdsetool-0.2.11 → cdsetool-0.2.12/src/cdsetool.egg-info}/PKG-INFO +6 -6
- {cdsetool-0.2.11 → cdsetool-0.2.12}/src/cdsetool.egg-info/requires.txt +2 -2
- {cdsetool-0.2.11 → cdsetool-0.2.12}/LICENSE +0 -0
- {cdsetool-0.2.11 → cdsetool-0.2.12}/setup.cfg +0 -0
- {cdsetool-0.2.11 → cdsetool-0.2.12}/src/cdsetool/__init__.py +0 -0
- {cdsetool-0.2.11 → cdsetool-0.2.12}/src/cdsetool/_processing.py +0 -0
- {cdsetool-0.2.11 → cdsetool-0.2.12}/src/cdsetool/logger.py +0 -0
- {cdsetool-0.2.11 → cdsetool-0.2.12}/src/cdsetool/monitor.py +0 -0
- {cdsetool-0.2.11 → cdsetool-0.2.12}/src/cdsetool/py.typed +0 -0
- {cdsetool-0.2.11 → cdsetool-0.2.12}/src/cdsetool.egg-info/SOURCES.txt +0 -0
- {cdsetool-0.2.11 → cdsetool-0.2.12}/src/cdsetool.egg-info/dependency_links.txt +0 -0
- {cdsetool-0.2.11 → cdsetool-0.2.12}/src/cdsetool.egg-info/entry_points.txt +0 -0
- {cdsetool-0.2.11 → cdsetool-0.2.12}/src/cdsetool.egg-info/top_level.txt +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cdsetool
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.12
|
|
4
4
|
Summary: Tools & CLI for interacting with CDSE product APIs
|
|
5
5
|
Author-email: Jacob Vejby <javej@sdfi.dk>
|
|
6
|
-
Project-URL: Homepage, https://github.com/
|
|
7
|
-
Project-URL: Bug Tracker, https://github.com/
|
|
6
|
+
Project-URL: Homepage, https://github.com/CDSETool/CDSETool
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/CDSETool/CDSETool/issues
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: Operating System :: OS Independent
|
|
10
10
|
Requires-Python: >=3.8
|
|
@@ -17,8 +17,8 @@ Requires-Dist: pyjwt[crypto]~=2.8.0
|
|
|
17
17
|
Requires-Dist: geopandas>=0.13.2
|
|
18
18
|
Provides-Extra: test
|
|
19
19
|
Requires-Dist: black==24.4.2; extra == "test"
|
|
20
|
-
Requires-Dist: pylint==3.2.
|
|
21
|
-
Requires-Dist: pytest==8.2
|
|
20
|
+
Requires-Dist: pylint==3.2.6; extra == "test"
|
|
21
|
+
Requires-Dist: pytest==8.3.2; extra == "test"
|
|
22
22
|
Requires-Dist: pytest-cov==5.0.0; extra == "test"
|
|
23
23
|
Requires-Dist: requests-mock==1.12.1; extra == "test"
|
|
24
24
|
Requires-Dist: pytest-mock==3.14.0; extra == "test"
|
|
@@ -96,7 +96,7 @@ cdsetool download Sentinel2 PATH/TO/DIR --concurrency 4 --search-term startDate=
|
|
|
96
96
|
Install `cdsetool` using pip:
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
|
-
pip install cdsetool==0.2.
|
|
99
|
+
pip install cdsetool==0.2.12
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
## Usage
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cdsetool"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.12"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="Jacob Vejby", email="javej@sdfi.dk" },
|
|
10
10
|
]
|
|
@@ -25,16 +25,16 @@ dependencies = [
|
|
|
25
25
|
[project.optional-dependencies]
|
|
26
26
|
test = [
|
|
27
27
|
"black==24.4.2",
|
|
28
|
-
"pylint==3.2.
|
|
29
|
-
"pytest==8.2
|
|
28
|
+
"pylint==3.2.6",
|
|
29
|
+
"pytest==8.3.2",
|
|
30
30
|
"pytest-cov==5.0.0",
|
|
31
31
|
"requests-mock==1.12.1",
|
|
32
32
|
"pytest-mock==3.14.0",
|
|
33
33
|
]
|
|
34
34
|
|
|
35
35
|
[project.urls]
|
|
36
|
-
"Homepage" = "https://github.com/
|
|
37
|
-
"Bug Tracker" = "https://github.com/
|
|
36
|
+
"Homepage" = "https://github.com/CDSETool/CDSETool"
|
|
37
|
+
"Bug Tracker" = "https://github.com/CDSETool/CDSETool/issues"
|
|
38
38
|
|
|
39
39
|
[project.scripts]
|
|
40
40
|
cdsetool = "cdsetool:cli.main"
|
|
@@ -12,9 +12,9 @@ from cdsetool.query import describe_collection, query_features
|
|
|
12
12
|
from cdsetool.monitor import StatusMonitor
|
|
13
13
|
from cdsetool.download import download_features
|
|
14
14
|
|
|
15
|
-
app = typer.Typer()
|
|
15
|
+
app = typer.Typer(no_args_is_help=True)
|
|
16
16
|
|
|
17
|
-
query_app = typer.Typer()
|
|
17
|
+
query_app = typer.Typer(no_args_is_help=True)
|
|
18
18
|
app.add_typer(query_app, name="query")
|
|
19
19
|
|
|
20
20
|
|
|
@@ -120,3 +120,7 @@ def _to_dict(term_list: List[str]) -> Dict[str, str]:
|
|
|
120
120
|
key, value = item.split("=")
|
|
121
121
|
search_terms[key] = value
|
|
122
122
|
return search_terms
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
if __name__ == "__main__":
|
|
126
|
+
main()
|
|
@@ -38,6 +38,7 @@ def download_feature(
|
|
|
38
38
|
log = _get_logger(options)
|
|
39
39
|
url = _get_feature_url(feature)
|
|
40
40
|
title = feature.get("properties").get("title")
|
|
41
|
+
temp_dir_usr = _get_temp_dir(options)
|
|
41
42
|
|
|
42
43
|
if not url or not title:
|
|
43
44
|
log.debug(f"Bad URL ('{url}') or title ('{title}')")
|
|
@@ -58,19 +59,25 @@ def download_feature(
|
|
|
58
59
|
# Always get a new session, credentials might have expired.
|
|
59
60
|
try:
|
|
60
61
|
session = _get_credentials(options).get_session()
|
|
61
|
-
except
|
|
62
|
-
log.warning(
|
|
62
|
+
except TokenClientConnectionError:
|
|
63
|
+
log.warning("Token client connection failed, retrying..")
|
|
64
|
+
continue
|
|
65
|
+
except TokenExpiredSignatureError:
|
|
66
|
+
log.warning("Token signature expired, retrying..")
|
|
63
67
|
continue
|
|
64
68
|
url = _follow_redirect(url, session)
|
|
65
|
-
|
|
69
|
+
name_dir_prefix = filename.replace(".zip", "____")
|
|
70
|
+
with session.get(url, stream=True) as response, tempfile.TemporaryDirectory(
|
|
71
|
+
prefix=name_dir_prefix, dir=temp_dir_usr
|
|
72
|
+
) as temp_dir:
|
|
66
73
|
if response.status_code != 200:
|
|
67
74
|
log.warning(f"Status code {response.status_code}, retrying..")
|
|
68
75
|
time.sleep(60 * (1 + (random.random() / 4)))
|
|
69
76
|
continue
|
|
70
77
|
|
|
71
78
|
status.set_filesize(int(response.headers["Content-Length"]))
|
|
72
|
-
|
|
73
|
-
with
|
|
79
|
+
tmp_file = os.path.join(temp_dir, "download.zip")
|
|
80
|
+
with open(tmp_file, "wb") as file:
|
|
74
81
|
# Server might not send all bytes specified by the
|
|
75
82
|
# Content-Length header before closing connection.
|
|
76
83
|
# Log as a warning and try again.
|
|
@@ -85,8 +92,8 @@ def download_feature(
|
|
|
85
92
|
) as e:
|
|
86
93
|
log.warning(e)
|
|
87
94
|
continue
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
# Close file before copy so all buffers are flushed.
|
|
96
|
+
shutil.copy(tmp_file, result_path)
|
|
90
97
|
return filename
|
|
91
98
|
log.error(f"Failed to download {filename}")
|
|
92
99
|
return None
|
|
@@ -143,3 +150,7 @@ def _get_credentials(options: Dict) -> Credentials:
|
|
|
143
150
|
return options.get("credentials") or Credentials(
|
|
144
151
|
proxies=options.get("proxies", None)
|
|
145
152
|
)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def _get_temp_dir(options: Dict) -> Union[str, None]:
|
|
156
|
+
return options.get("tmpdir") or None
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cdsetool
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.12
|
|
4
4
|
Summary: Tools & CLI for interacting with CDSE product APIs
|
|
5
5
|
Author-email: Jacob Vejby <javej@sdfi.dk>
|
|
6
|
-
Project-URL: Homepage, https://github.com/
|
|
7
|
-
Project-URL: Bug Tracker, https://github.com/
|
|
6
|
+
Project-URL: Homepage, https://github.com/CDSETool/CDSETool
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/CDSETool/CDSETool/issues
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: Operating System :: OS Independent
|
|
10
10
|
Requires-Python: >=3.8
|
|
@@ -17,8 +17,8 @@ Requires-Dist: pyjwt[crypto]~=2.8.0
|
|
|
17
17
|
Requires-Dist: geopandas>=0.13.2
|
|
18
18
|
Provides-Extra: test
|
|
19
19
|
Requires-Dist: black==24.4.2; extra == "test"
|
|
20
|
-
Requires-Dist: pylint==3.2.
|
|
21
|
-
Requires-Dist: pytest==8.2
|
|
20
|
+
Requires-Dist: pylint==3.2.6; extra == "test"
|
|
21
|
+
Requires-Dist: pytest==8.3.2; extra == "test"
|
|
22
22
|
Requires-Dist: pytest-cov==5.0.0; extra == "test"
|
|
23
23
|
Requires-Dist: requests-mock==1.12.1; extra == "test"
|
|
24
24
|
Requires-Dist: pytest-mock==3.14.0; extra == "test"
|
|
@@ -96,7 +96,7 @@ cdsetool download Sentinel2 PATH/TO/DIR --concurrency 4 --search-term startDate=
|
|
|
96
96
|
Install `cdsetool` using pip:
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
|
-
pip install cdsetool==0.2.
|
|
99
|
+
pip install cdsetool==0.2.12
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
## Usage
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|