Deposit Metadata to Crossref using Depositor
masterThe library implements the doMDUpload operation, allowing you to submit Digital Object Metadata to Crossref.
Prerequisites:
- An active publisher account with crossref.org.
- A valid XML file following the Crossref DTD.
Workflow:
- Initialize a
Depositorinstance with your prefix, Crossref username, and password. - Use
register_doito submit your XML metadata. Note that this initiates a request; it does not guarantee immediate registration. - Use
request_doi_status_by_filenameto poll for the status of your submission until a success or error status is retrieved.
from crossref.restful import Depositor
# Load your XML
request_xml = open('path/to/your_metadata.xml', 'r').read()
# Initialize depositor
depositor = Depositor('your prefix', 'your crossref user', 'your crossref password')
# Submit the request
response = depositor.register_doi('your_batch_id', request_xml)
# Check status
status_response = depositor.request_doi_status_by_filename('your_batch_id.xml')
print(status_response.text)