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.
Files changed (128) hide show
  1. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/LICENSE +1 -1
  2. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/PKG-INFO +1 -1
  3. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/__init__.py +3 -1
  4. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/_initialization.py +2 -1
  5. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/utils.py +12 -34
  6. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/references.py +7 -1
  7. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/protocols.py +2 -0
  8. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/zenodo/core.py +1 -1
  9. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox.egg-info/PKG-INFO +1 -1
  10. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/pyproject.toml +1 -1
  11. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/README.md +0 -0
  12. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/__init__.py +0 -0
  13. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/_cfg.py +0 -0
  14. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/_repr.py +0 -0
  15. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/_version.py +0 -0
  16. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/abstracts.py +0 -0
  17. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/core.py +0 -0
  18. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/profiles.py +0 -0
  19. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/query_templates.py +0 -0
  20. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/stores/__init__.py +0 -0
  21. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/catalog/stores/hdf5.py +0 -0
  22. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/cli.py +0 -0
  23. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/consts.py +0 -0
  24. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/__init__.py +0 -0
  25. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/cfg.py +0 -0
  26. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/consts.py +0 -0
  27. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/core.py +0 -0
  28. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/errors.py +0 -0
  29. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/generate.py +0 -0
  30. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/ontology/__init__.py +0 -0
  31. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/ontology/h5ontocls.py +0 -0
  32. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/ontology/hdf_datatypes.py +0 -0
  33. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/standard_attributes.py +0 -0
  34. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/toolbox_validators.py +0 -0
  35. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/convention/utils.py +0 -0
  36. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/def_icon.png +0 -0
  37. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/fluid-v1.yml +0 -0
  38. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/h5tbx.yaml +0 -0
  39. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/id_icon.png +0 -0
  40. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/iri_icon.png +0 -0
  41. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/ld_icon.png +0 -0
  42. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/piv-v1.yml +0 -0
  43. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/style.css +0 -0
  44. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/tutorial_convention.yaml +0 -0
  45. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/tutorial_convention_vfuncs.py +0 -0
  46. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/tutorial_standard_name_table.yaml +0 -0
  47. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/data/type_icon.png +0 -0
  48. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/__init__.py +0 -0
  49. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/hdfdb/__init__.py +0 -0
  50. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/hdfdb/filedb.py +0 -0
  51. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/hdfdb/objdb.py +0 -0
  52. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/hdfdb/query.py +0 -0
  53. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/hdfdb/utils.py +0 -0
  54. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/interface.py +0 -0
  55. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/lazy.py +0 -0
  56. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/database/mongo.py +0 -0
  57. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/errors.py +0 -0
  58. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/extensions/__init__.py +0 -0
  59. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/extensions/magnitude.py +0 -0
  60. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/extensions/normalize.py +0 -0
  61. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/extensions/onto.py +0 -0
  62. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/extensions/units.py +0 -0
  63. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/extensions/vector.py +0 -0
  64. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/gui/__init__.py +0 -0
  65. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/gui/fairify.py +0 -0
  66. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/gui/src/__init__.py +0 -0
  67. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/gui/src/main.py +0 -0
  68. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/identifiers.py +0 -0
  69. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/layout/__init__.py +0 -0
  70. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/layout/core.py +0 -0
  71. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/__init__.py +0 -0
  72. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/globals.py +0 -0
  73. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/hdf/__init__.py +0 -0
  74. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/hdf/attributes.py +0 -0
  75. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/hdf/datasets.py +0 -0
  76. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/hdf/file.py +0 -0
  77. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/hdf/groups.py +0 -0
  78. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/rdf.py +0 -0
  79. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/shacl.py +0 -0
  80. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/user/__init__.py +0 -0
  81. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/user/attributes.py +0 -0
  82. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/user/datasets.py +0 -0
  83. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/user/file.py +0 -0
  84. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/user/groups.py +0 -0
  85. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/user/utils.py +0 -0
  86. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/ld/utils.py +0 -0
  87. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/plotting.py +0 -0
  88. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/protected_attributes.py +0 -0
  89. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/__init__.py +0 -0
  90. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/default_metamapper.py +0 -0
  91. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/interface.py +0 -0
  92. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/utils.py +0 -0
  93. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/zenodo/__init__.py +0 -0
  94. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/zenodo/metadata.py +0 -0
  95. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/zenodo/tokens.py +0 -0
  96. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/repository/zenodo/utils.py +0 -0
  97. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/tutorial.py +0 -0
  98. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/user.py +0 -0
  99. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/utils.py +0 -0
  100. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/__init__.py +0 -0
  101. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/accessor.py +0 -0
  102. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/accessors/__init__.py +0 -0
  103. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/accessors/provenance.py +0 -0
  104. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/core.py +0 -0
  105. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/ds_decoder.py +0 -0
  106. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/h5attr.py +0 -0
  107. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/h5ext.py +0 -0
  108. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/h5utils.py +0 -0
  109. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/h5yaml.py +0 -0
  110. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/jsonld.py +0 -0
  111. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox/wrapper/xr2hdf.py +0 -0
  112. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox.egg-info/SOURCES.txt +0 -0
  113. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox.egg-info/dependency_links.txt +0 -0
  114. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox.egg-info/entry_points.txt +0 -0
  115. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox.egg-info/requires.txt +0 -0
  116. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/h5rdmtoolbox.egg-info/top_level.txt +0 -0
  117. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/setup.cfg +0 -0
  118. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_cli.py +0 -0
  119. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_config.py +0 -0
  120. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_extensions.py +0 -0
  121. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_identifiers.py +0 -0
  122. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_plotting.py +0 -0
  123. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_readme.py +0 -0
  124. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_repr.py +0 -0
  125. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_user.py +0 -0
  126. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_utils.py +0 -0
  127. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_version.py +0 -0
  128. {h5rdmtoolbox-2.6.1 → h5rdmtoolbox-2.6.2}/tests/test_xarray_export.py +0 -0
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2023 Scott Chacon and others
1
+ Copyright (c) 2022-2026 h5rdmtoolbox contributors
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: h5rdmtoolbox
3
- Version: 2.6.1
3
+ Version: 2.6.2
4
4
  Summary: Supporting a FAIR Research Data lifecycle using Python and HDF5.
5
5
  Author-email: Matthias Probst <matth.probst@gmail.com>
6
6
  License-Expression: MIT
@@ -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, web_resources=list_of_ttl_web_resources
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[DownloadStatus]:
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
- resp = requests.get(url, stream=True, timeout=60)
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:
@@ -149,6 +149,8 @@ class H5TbxAttributeManager(Protocol):
149
149
  def parent(self):
150
150
  ...
151
151
 
152
+ def items(self):
153
+ pass
152
154
 
153
155
  class H5TbxHLObject(Protocol):
154
156
  name: str
@@ -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})
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: h5rdmtoolbox
3
- Version: 2.6.1
3
+ Version: 2.6.2
4
4
  Summary: Supporting a FAIR Research Data lifecycle using Python and HDF5.
5
5
  Author-email: Matthias Probst <matth.probst@gmail.com>
6
6
  License-Expression: MIT
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "h5rdmtoolbox"
10
- version = "2.6.1"
10
+ version = "2.6.2"
11
11
  description = "Supporting a FAIR Research Data lifecycle using Python and HDF5."
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.9, <3.14"
File without changes
File without changes