Commit 232b5049 authored by Rémy Decoupes's avatar Rémy Decoupes
Browse files

fix attempt/retry Xref

parent efe384f1
No related merge requests found
Showing with 10 additions and 1 deletion
+10 -1
...@@ -217,7 +217,16 @@ def get_citation_count(doi): ...@@ -217,7 +217,16 @@ def get_citation_count(doi):
api_url = f'https://api.crossref.org/works/{doi}' api_url = f'https://api.crossref.org/works/{doi}'
# Perform the request to the CrossRef Metadata API # Perform the request to the CrossRef Metadata API
response = requests.get(api_url) max_retries = 5
delay = 2
for attempt in range(1, max_retries + 1):
try:
response = requests.get(api_url)
if response.status_code == 200:
break
except:
print(f"Could not get crossref {doi}")
# Check if the request was successful (status code 200) # Check if the request was successful (status code 200)
if response.status_code == 200: if response.status_code == 200:
......
Supports Markdown
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