Skip to content

Commit 2972fca

Browse files
authored
Fix datahugger errors for CrossRef DOIs (#58)
1 parent beb81bf commit 2972fca

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

datahugger/resolvers.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import re
33
from urllib.parse import urlparse
44

5+
import requests
6+
57
from datahugger.config import RE3DATA_SOFTWARE
68
from datahugger.config import SERVICES_NETLOC
79
from datahugger.config import SERVICES_NETLOC_REGEXP
@@ -51,11 +53,15 @@ def _resolve_service_with_re3data(doi):
5153
return None
5254

5355
logging.info("Resolve service with datacite and re3data")
54-
publisher = get_datapublisher_from_doi(doi)
56+
try:
57+
publisher = get_datapublisher_from_doi(doi)
58+
except requests.HTTPError:
59+
return None
5560
logging.info(f"Datacite publisher of dataset: {publisher}")
5661

5762
if not publisher:
58-
raise ValueError("Can't resolve the publisher from the DOI.")
63+
logging.info("Can't resolve the publisher from the DOI.")
64+
return None
5965

6066
data_repos = get_re3data_repositories()
6167

0 commit comments

Comments
 (0)