ImperialCollegeLondon / safedata_validator

Python tools to validate and publish datasets using the safedata metadata format.
https://safedata-validator.readthedocs.io/
MIT License
2 stars 4 forks source link

Updating zenodo and metadata server handling #179

Closed davidorme closed 2 weeks ago

davidorme commented 1 month ago

This PR is a very over the top response to close #177

The issue there was that the previous handling of request responses was passing back just JSON data and error messages in a rather limited sort of way. That made it hard/hacky (string regexes on HTML text) to detect the reasons for a request failure. This PR creates new dataclasses to manage the resources and response handling for both the zenodo and metadata server use of requests. That removes some repetitious code as well as creating a cleaner and more flexible interface that includes explicit ok and status_code attributes. Changing that for Zenodo meant that we needed similar structures for the metadata server code.

That is all then updated in the entry_points.py, including some tidying of JSON data loading into one location.

Obviously, we don't yet have testing in place for this part of the package, but I've successfully published a dataset and new version of that dataset to the sandbox: https://sandbox.zenodo.org/records/91217