Last active
November 5, 2015 00:48
-
-
Save dartar/397ddb8c46b517b14c22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import httplib | |
import sys | |
base_url = "dx.doi.org" | |
for line in sys.stdin: | |
doi = line.strip() | |
url = base_url + doi | |
conn = httplib.HTTPConnection(base_url) | |
conn.request("HEAD", "/" + doi) | |
res = conn.getresponse() | |
e = 1 if res.status == 303 else 0 | |
print doi + "\t" + str(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for caching metadata instead of calling the resolver, we can use the
works
endpoint of the API, something like: