Permalink
Browse files

sweet-and-simple DOI resolver

  • Loading branch information...
1 parent ec1e91f commit 3093f444299969c6d49f83239f33401809dee6a0 @kanzure committed Mar 4, 2010
View
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
20 doi.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+#author: Bryan Bishop <kanzure@gmail.com>
+#date: 2010-03-04
+#purpose: resolve a pesky DOI number
+import urllib2, httplib
+import optfunc
+httplib.HTTPConnection.debuglevel = 1
+
+user_agent = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.5) Gecko/20091123 Iceweasel/3.5.5 (like Firefox/3.5.5; Debian-3.5.5-1)"
+
+def doi(number):
+ '''resolves a DOI number, like: 10.1038/nature01036'''
+
+ request = urllib2.Request("http://dx.doi.org/%s" % (number))
+ opener = urllib2.build_opener()
+ f = opener.open(request)
+ print f.url, "\n"
+
+if __name__ == "__main__":
+ optfunc.run(doi)

0 comments on commit 3093f44

Please sign in to comment.