From d3ac1661166d4c213e01fca836b35a52da232acb Mon Sep 17 00:00:00 2001 From: Boris Ponsioen <b.g.t.ponsioen@uva.nl> Date: Mon, 16 Apr 2018 15:14:01 +0200 Subject: [PATCH] Readds error handling in get_crossref_test temporarily --- metacore/services.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/metacore/services.py b/metacore/services.py index 3fb4d99a2..0bb08a22d 100644 --- a/metacore/services.py +++ b/metacore/services.py @@ -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']) -- GitLab