h5rdmtoolbox 2.6.1__tar.gz → 2.6.2__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.
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/LICENSE +1 -1
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/PKG-INFO +1 -1
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/__init__.py +3 -1
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/_initialization.py +2 -1
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/utils.py +12 -34
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/references.py +7 -1
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/protocols.py +2 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/zenodo/core.py +1 -1
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox.egg-info/PKG-INFO +1 -1
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/pyproject.toml +1 -1
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/README.md +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/_cfg.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/_repr.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/_version.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/abstracts.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/core.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/profiles.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/query_templates.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/stores/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/stores/hdf5.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/cli.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/consts.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/cfg.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/consts.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/core.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/errors.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/generate.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/ontology/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/ontology/h5ontocls.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/ontology/hdf_datatypes.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/standard_attributes.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/toolbox_validators.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/utils.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/def_icon.png +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/fluid-v1.yml +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/h5tbx.yaml +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/id_icon.png +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/iri_icon.png +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/ld_icon.png +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/piv-v1.yml +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/style.css +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/tutorial_convention.yaml +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/tutorial_convention_vfuncs.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/tutorial_standard_name_table.yaml +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/type_icon.png +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/hdfdb/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/hdfdb/filedb.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/hdfdb/objdb.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/hdfdb/query.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/hdfdb/utils.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/interface.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/lazy.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/mongo.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/errors.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/extensions/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/extensions/magnitude.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/extensions/normalize.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/extensions/onto.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/extensions/units.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/extensions/vector.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/gui/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/gui/fairify.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/gui/src/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/gui/src/main.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/identifiers.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/layout/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/layout/core.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/globals.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/hdf/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/hdf/attributes.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/hdf/datasets.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/hdf/file.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/hdf/groups.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/rdf.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/shacl.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/user/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/user/attributes.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/user/datasets.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/user/file.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/user/groups.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/user/utils.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/utils.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/plotting.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/protected_attributes.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/default_metamapper.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/interface.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/utils.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/zenodo/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/zenodo/metadata.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/zenodo/tokens.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/zenodo/utils.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/tutorial.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/user.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/utils.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/accessor.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/accessors/__init__.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/accessors/provenance.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/core.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/ds_decoder.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/h5attr.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/h5ext.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/h5utils.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/h5yaml.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/jsonld.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/xr2hdf.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox.egg-info/SOURCES.txt +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox.egg-info/dependency_links.txt +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox.egg-info/entry_points.txt +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox.egg-info/requires.txt +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox.egg-info/top_level.txt +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/setup.cfg +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_cli.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_config.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_extensions.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_identifiers.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_plotting.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_readme.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_repr.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_user.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_utils.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_version.py +0 -0
- {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_xarray_export.py +0 -0
|
@@ -117,7 +117,9 @@ def _download_catalog_datasets(
|
|
|
117
117
|
f"Found {n_ttl_resources} TTL web resources to download. Downloading to {download_directory}..."
|
|
118
118
|
)
|
|
119
119
|
return download(
|
|
120
|
-
download_directory=download_directory,
|
|
120
|
+
download_directory=download_directory,
|
|
121
|
+
web_resources=list_of_ttl_web_resources,
|
|
122
|
+
use_agent_header=True
|
|
121
123
|
)
|
|
122
124
|
|
|
123
125
|
|
|
@@ -84,5 +84,6 @@ def database_initialization(
|
|
|
84
84
|
f"Found {len(list_of_ttl_web_resources)} TTL web resources to download. Downloading to {download_directory}...")
|
|
85
85
|
return download(
|
|
86
86
|
download_directory=download_directory,
|
|
87
|
-
web_resources=list_of_ttl_web_resources
|
|
87
|
+
web_resources=list_of_ttl_web_resources,
|
|
88
|
+
use_agent_header=True
|
|
88
89
|
)
|
|
@@ -17,6 +17,7 @@ from pydantic.v1 import HttpUrl
|
|
|
17
17
|
from rdflib import Graph
|
|
18
18
|
|
|
19
19
|
from .. import logger
|
|
20
|
+
from .._version import __version__
|
|
20
21
|
|
|
21
22
|
# --- minimal caster for common XSD datatypes ---
|
|
22
23
|
_XSD = "http://www.w3.org/2001/XMLSchema#"
|
|
@@ -28,6 +29,10 @@ _NUM_DT = {
|
|
|
28
29
|
_FLOAT_DT = {_XSD + "float", _XSD + "double"}
|
|
29
30
|
_DEC_DT = {_XSD + "decimal"}
|
|
30
31
|
|
|
32
|
+
USER_AGENT_HEADER = {
|
|
33
|
+
"User-Agent": f"h5rdmtoolbox/{__version__} (https://github.com/matthiasprobst/h5rdmtoolbox)",
|
|
34
|
+
}
|
|
35
|
+
|
|
31
36
|
|
|
32
37
|
def file_uri_or_path_to_path(value) -> pathlib.Path:
|
|
33
38
|
# Keep behavior close to your code
|
|
@@ -190,40 +195,8 @@ def extract_record_id(value: str) -> str:
|
|
|
190
195
|
raise ValueError(f"Could not extract a numeric record ID from '{value}'")
|
|
191
196
|
|
|
192
197
|
|
|
193
|
-
def get_file_metadata(record: str, sandbox: bool = False) -> Iterator[Tuple[str, Dict]]:
|
|
194
|
-
"""
|
|
195
|
-
Fetch the Zenodo record JSON and yield (filename, file-metadata-dict) tuples.
|
|
196
|
-
"""
|
|
197
|
-
record_id = extract_record_id(record)
|
|
198
|
-
base_url = "https://sandbox.zenodo.org/api/records" if sandbox else "https://zenodo.org/api/records"
|
|
199
|
-
url = f"{base_url}/{record_id}"
|
|
200
|
-
|
|
201
|
-
resp = requests.get(url)
|
|
202
|
-
if resp.status_code != 200:
|
|
203
|
-
raise RuntimeError(
|
|
204
|
-
f"Failed to fetch record {record_id}: HTTP {resp.status_code} - {resp.text}"
|
|
205
|
-
)
|
|
206
198
|
|
|
207
|
-
data = resp.json()
|
|
208
199
|
|
|
209
|
-
# Zenodo records normally have 'files' at the top level
|
|
210
|
-
files = data.get("files", [])
|
|
211
|
-
|
|
212
|
-
if not files:
|
|
213
|
-
# Some records may store file info differently; handle gracefully
|
|
214
|
-
raise RuntimeError(f"No files found in record {record_id} (or unexpected schema).")
|
|
215
|
-
|
|
216
|
-
for f in files:
|
|
217
|
-
# Common fields in Zenodo API
|
|
218
|
-
name = f.get("key") or f.get("filename") or "<unknown>"
|
|
219
|
-
yield name, f
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
def _is_sandbox_doi(doi: str) -> bool:
|
|
223
|
-
"""Return True if the provided doi string looks like a sandbox URL/DOI."""
|
|
224
|
-
if "10.5281/zenodo" in doi:
|
|
225
|
-
return True
|
|
226
|
-
return False
|
|
227
200
|
|
|
228
201
|
|
|
229
202
|
def download_and_verify_file(file_meta: Dict, dest_dir: pathlib.Path) -> Tuple[pathlib.Path, bool, str, str]:
|
|
@@ -312,7 +285,8 @@ def parse_checksum(raw: str) -> Tuple[str, str]:
|
|
|
312
285
|
return algo.lower(), val.lower()
|
|
313
286
|
|
|
314
287
|
|
|
315
|
-
def download(download_directory: pathlib.Path, web_resources: List[WebResource]) -> List[
|
|
288
|
+
def download(download_directory: pathlib.Path, web_resources: List[WebResource], use_agent_header=True) -> List[
|
|
289
|
+
DownloadStatus]:
|
|
316
290
|
"""Download and verify a list of WebResource items.
|
|
317
291
|
|
|
318
292
|
For each resource:
|
|
@@ -403,7 +377,11 @@ def download(download_directory: pathlib.Path, web_resources: List[WebResource])
|
|
|
403
377
|
# stream download to tmp file while computing md5
|
|
404
378
|
tmp_path = record_dir / (filename + ".tmp")
|
|
405
379
|
try:
|
|
406
|
-
|
|
380
|
+
if use_agent_header:
|
|
381
|
+
kwargs_request = {"headers": USER_AGENT_HEADER}
|
|
382
|
+
else:
|
|
383
|
+
kwargs_request = {}
|
|
384
|
+
resp = requests.get(url, stream=True, timeout=60, **kwargs_request)
|
|
407
385
|
resp.raise_for_status()
|
|
408
386
|
|
|
409
387
|
md5 = hashlib.md5()
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import requests
|
|
2
2
|
|
|
3
|
+
from h5rdmtoolbox import __version__
|
|
4
|
+
|
|
5
|
+
USER_AGENT_HEADER = {
|
|
6
|
+
"User-Agent": f"h5rdmtoolbox/{__version__} (https://github.com/matthiasprobst/h5rdmtoolbox)",
|
|
7
|
+
}
|
|
8
|
+
|
|
3
9
|
|
|
4
10
|
def validate_url(url: str) -> bool:
|
|
5
11
|
"""Validate URL
|
|
@@ -15,7 +21,7 @@ def validate_url(url: str) -> bool:
|
|
|
15
21
|
True if URL
|
|
16
22
|
"""
|
|
17
23
|
try:
|
|
18
|
-
response = requests.get(url)
|
|
24
|
+
response = requests.get(url, headers=USER_AGENT_HEADER)
|
|
19
25
|
except requests.exceptions.MissingSchema:
|
|
20
26
|
return False
|
|
21
27
|
if response.status_code == 200:
|
|
@@ -221,7 +221,7 @@ class ZenodoRecord(RepositoryInterface):
|
|
|
221
221
|
return r.json()
|
|
222
222
|
|
|
223
223
|
record_url = url.replace("deposit/depositions/", "records/")
|
|
224
|
-
r = requests.get(record_url)
|
|
224
|
+
r = requests.get(record_url, headers=USER_AGENT_HEADER)
|
|
225
225
|
if r.status_code == 404:
|
|
226
226
|
access_token = self.access_token
|
|
227
227
|
r = requests.get(url, params={"access_token": access_token})
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
{h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/tutorial_standard_name_table.yaml
RENAMED
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|