SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit d3ac1661 authored by Boris Ponsioen's avatar Boris Ponsioen
Browse files

Readds error handling in get_crossref_test temporarily

parent 02a4d0e2
No related branches found
No related tags found
No related merge requests found
......@@ -20,17 +20,20 @@ def get_crossref_test(cursor='*'):
# If the loop is allowed to complete, it fetches (rows * batches) records
rows = 500
batches = 2000
last_cursor = cursor
for i in range(0,batches):
print("-------------------------------")
print("Batch %s" % (i, ))
print(cursor)
print("Last cursor: ", last_cursor)
print("Current cursor: ", cursor)
params = {'cursor': cursor, 'rows': rows, 'mailto': 'b.g.t.ponsioen@uva.nl'}
r = requests.get(url, params=params)
r_json = r.json()
citables_json = r_json['message']['items']
last_cursor = cursor
cursor = r_json['message']['next-cursor']
number_of_results = len(r_json['message']['items'])
......@@ -111,4 +114,4 @@ def parse_crossref_citable(citable_item):
# # raise
except Exception as e:
print("Error: ", e)
print(citable_item)
print(citable_item['DOI'])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment