Skip to content

Instantly share code, notes, and snippets.

@TomDemeranville
Last active December 20, 2019 11:50
Show Gist options
  • Save TomDemeranville/2db940a1187c9a7a403f476d660c2a86 to your computer and use it in GitHub Desktop.
Save TomDemeranville/2db940a1187c9a7a403f476d660c2a86 to your computer and use it in GitHub Desktop.
import urllib.request
import json
url = 'https://doi.org/10.1038/s41586-019-1863-2'
headers = {'Accept': 'application/citeproc+json'}
req = urllib.request.Request(url, {}, headers)
with urllib.request.urlopen(req) as response:
doi_metadata = response.read()
doi_json = json.loads(doi_metadata)
print(doi_json["ISSN"])
@TomDemeranville
Copy link
Author

Example use and output:

Toms-MacBook-Pro-4:Desktop tom$ python3 DOItoISSN.py
['0028-0836', '1476-4687']

@TomDemeranville
Copy link
Author

Note that not all DOIs have an ISSN, as not everything is published in a journal!

@TomDemeranville
Copy link
Author

To get ISSNs for an ORCID account

  1. Read their list of works
  2. For each work that does not have an ISSN, but does have a DOI use the DOI API to discover the ISSN. This will work for Crossref, Datacite, Medra, KISTI DOIs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment