Skip to content

Commit

Permalink
Fix datahugger errors for CrossRef DOIs (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
J535D165 authored Sep 14, 2023
1 parent beb81bf commit 2972fca
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions datahugger/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import re
from urllib.parse import urlparse

import requests

from datahugger.config import RE3DATA_SOFTWARE
from datahugger.config import SERVICES_NETLOC
from datahugger.config import SERVICES_NETLOC_REGEXP
Expand Down Expand Up @@ -51,11 +53,15 @@ def _resolve_service_with_re3data(doi):
return None

logging.info("Resolve service with datacite and re3data")
publisher = get_datapublisher_from_doi(doi)
try:
publisher = get_datapublisher_from_doi(doi)
except requests.HTTPError:
return None
logging.info(f"Datacite publisher of dataset: {publisher}")

if not publisher:
raise ValueError("Can't resolve the publisher from the DOI.")
logging.info("Can't resolve the publisher from the DOI.")
return None

data_repos = get_re3data_repositories()

Expand Down

0 comments on commit 2972fca

Please sign in to comment.