Commit 4d26f442 authored by Jean Michel Rouly's avatar Jean Michel Rouly

Fixed api timeout

parent 6172c9c6
......@@ -31,7 +31,13 @@ def ISBNMetadata(standardISBN):
url = "http://xisbn.worldcat.org/webservices/xid/isbn/" +\
str(standardISBN) +\
"?method=getMetadata&format=json&fl=title,year,author,ed"
metadata = requests.get(url)
# In case the API fails to return, simply return None.
try:
metadata = requests.get(url, timeout=0.1)
except ConnectionError:
return None
# format into a dictionary
dejson = metadata.json()
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment