Fetching Doi metadata using python

640 Views Asked by At

I want to fetch Bibtex citation from doi in Python. So the way I achieved it is by using this function:

   def BibtexFromDoi(doi):
       url =  "http://dx.doi.org/" + doi
       headers = {"accept": "application/x-bibtex"}
       r = requests.get(url, headers=headers)
       return r.text

The problem with that, is that it takes so long to run this code, it takes from 10 to 15 minutes to get a response. I was wondering on what can be done to enhance the code and make it run faster In addition, I tried using Curl on the command line and it turns out to be faster with Curl, it only takes 1 to 2 seconds. I would like to achieve the same spead but on python.

0

There are 0 best solutions below