-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyError: 'key'
in ZenodoRepository.download_url() after Zenodo migration
#371
Comments
I have the same problem, and couldn't work it out. Thanks for identifying! |
Thanks @khaeru for opening this issue. I can reproduce the error with the script you shared, and I've also checked that our tests are failing because of the change in Zenodo API. I'll try to work on a quick bugfix and make a new release. At the moment I see that https://developers.zenodo.org is down, so I won't be able to get further information about the new API and will have to rely on the JSON structure and try to cover most cases. I'll probably ping you and @paddyroddy so you can test the bugfix against your use cases. Thanks again for the detailed report! It's super helpful! PS: I'm leaving the url for the API response for the repository in the example, just to have a quick way to access it when memory isn't helping: https://zenodo.org/api/records/5793870 |
Thanks, @santisoler, for reference mine is just from here https://github.com/astro-informatics/sleplet/blob/12efdcd8d1b65900de7cea736c20d60c224aa9f4/src/sleplet/_data/setup_pooch.py#L11-L17 import pooch
_ZENODO_DATA_DOI = "10.5281/zenodo.7767698"
_POOCH = pooch.create(
path=pooch.os_cache("sleplet"),
base_url=f"doi:{_ZENODO_DATA_DOI}/",
registry=None,
)
_POOCH.load_registry_from_doi() |
Pooch v1.8.0 has been released, including the bugfix we merged in #375 to solve this issue. The new release is already available in PyPI: https://pypi.org/project/pooch/ Availability through conda-forge might take a few hours. Thanks @khaeru again for opening this issue and all of you that reported back. |
Thank you for the quick fix! |
Just to keep everyone in the loop: I received another reply from Zenodo. They restored the old behaviour of the API, so our downloader is using the "legacy" version of the API. For the repository that @khaeru shared in the example, now we have the following list of files:
Note that:
Since the support for this API was kept, our downloader is still working just fine! |
Unrelated, but I've noticed that the API seems to be a lot more rate limiting that it used to be, i.e. my CI is breaking. Have you noticed the same? |
I've rerun Pooch's tests both locally and through GitHub Actions and I haven't noticed that. If this persists, I would recommend you to get in touch with Zenodo, they are super responsive. |
Zenodo recently migrated to InvenioRDM, as described here (cf. #350). Since then, the service has had sporadic downtime; see a header message on https://zenodo.com ("Oct 15 08:30 UTC: We are continuing to work on resolving identified issues") and sporadic downtime here.
It appears that Zenodo's API responses have changed in a way that causes errors in pooch. Excerpting from the below output, I see:
The single record in the "files" collection does not have a key
'key'
.Zenodo published What's changed? and What's new? pages describing the migration, but they don't indicate any API changes. Its API documentation doesn't indicate a new version. So I am not sure if:
Regardless of which is the case, a fix would be welcome! However I recognize in either case it is difficult to adapt to an API change which is either not documented or accidental.
Full code that generated the error
As well, to help diagnose/debug, I have edited pooch.downloads.ZenodoRepository.download_url(), inserting the line:
Full error message
System information
The text was updated successfully, but these errors were encountered: