inveniosoftware / datacite

Python API wrapper for the DataCite API.
https://datacite.readthedocs.io
Other
27 stars 33 forks source link

Add support for new DataCite JSON REST API #52

Closed tmorrell closed 3 years ago

tmorrell commented 5 years ago

DataCite has a new JSON REST API, and this PR will add a new client for interacting with this API. At a minimum it will handle getting DOI metadata and all DOI minting functionality. The REST API will eventually replace the existing MDS API.

I've added in some tests that require a DataCite test password; these are marked so travis should still be happy.

I haven't finished building out tests, and there are a few more functions to write before this is ready for review.

tmorrell commented 4 years ago

This is ready for review. The commits are a mess because I include both the 4.2 and 4.3 PRs. I'll rebase once those are approved. I also don't know why the travis 2.7 build is failing; seems like a really early configuration step.

This JSON API follows the same structure as the MDS wrapper, but I added a lot more helper functions for common DOI operations.

New files to look at: https://github.com/caltechlibrary/datacite/blob/rest-api/datacite/rest_client.py https://github.com/caltechlibrary/datacite/blob/rest-api/tests/test_rest.py

I've added tests that make DOIs in the DataCite test system, but that don't run on travis. Set the following environment variables $DATACITE_USER, $DATACITE_PW, $DATACITE_PREFIX with your account information for doi.test.datacite.org and run ./run-tests-pw.sh

Three tests will fail because DataCite hasn't implemented geoLocationPolygon yet https://github.com/datacite/lupo/issues/327

Feedback is much appreciated!

tmorrell commented 3 years ago

I've verified that the live DataCite tests still pass. The records with geoLocationPolygon metadata don't fail anymore, but the polygon metadata isn't included because DataCite hasn't implemented that field yet.