Skip to content

Commit

Permalink
update to zenodo_search==0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasprobst committed Oct 27, 2023
1 parent 3a6aab5 commit d0562b3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Log of changes in the versions

## v0.12.1
- bugfix in zenodo search (did Zenodo change their API?)

## v0.12.0
- 0D data is written to MongoDB
- new utils like computing filesize
Expand Down
4 changes: 2 additions & 2 deletions h5rdmtoolbox/conventions/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def from_zenodo(doi, name=None,
if not filename.exists() or force_download:
record = zsearch.search_doi(doi, parse_doi=False)
if name is None:
matches = [file for file in record.files if file['filename'].rsplit('.', 1)[-1] == 'yaml']
matches = [file for file in record.files if file['key'].rsplit('.', 1)[-1] == 'yaml']
if len(matches) == 0:
raise ValueError(f'No file with suffix ".yaml" found in record {doi}')
else:
Expand All @@ -545,7 +545,7 @@ def from_zenodo(doi, name=None,
raise ValueError(f'No file with name "{name}" found in record {doi}')

file0 = zsearch.ZenodoFile(matches[0])
if file0['filename'].rsplit('.', 1)[-1] != 'yaml':
if file0['key'].rsplit('.', 1)[-1] != 'yaml':
raise ValueError(f'The file with name "{name}" is not a YAML file')

_filename = file0.download(destination_dir=filename.parent)
Expand Down
2 changes: 1 addition & 1 deletion h5rdmtoolbox/conventions/standard_names/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ def from_zenodo(doi: str) -> "StandardNameTable":
zenrec = zsearch.search_doi(doi)
zenfile = zenrec.files[0]

yaml_name = zenrec.files[0]['filename']
yaml_name = zenrec.files[0]['key']
if not yaml_name.endswith('.yaml'):
raise ValueError(f'Expected yaml file, got {yaml_name}')
_yaml_filename = zenfile.download()
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = h5rdmtoolbox
version = 0.12.0
version = 0.12.1
author = Matthias Probst
author_email = matthias.probst@kit.edu
description = Supporting a FAIR Research Data lifecycle using Python and HDF5.
Expand Down Expand Up @@ -34,7 +34,7 @@ install_requires =
packaging
python-forge == 18.6.0
requests
zenodo_search == 0.2.0
zenodo_search == 0.2.1
pydantic >= 2.3.0

[options.extras_require]
Expand Down

0 comments on commit d0562b3

Please sign in to comment.