Skip to content

Commit

Permalink
fix: handle zenodo api inconsistency (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maurier authored Sep 5, 2024
1 parent bc087cd commit d086789
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dspback/routers/zenodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,16 @@ async def _retrieve_metadata_from_repository(self, request: Request, identifier)
grants = []

for grant in grants:
number = grant['id'].split("::")[-1]
# Grant metadata coming from their 'records' url have different properties. The grant id will the 'code' property
number = None
print(grant)
if "id" in grant:
number = grant["id"].split("::")[-1]
elif "code" in grant:
number = grant["code"]

# We will filter out the ones not found later
grant['id'] = None
grant["id"] = None

try:
response = requests.get("https://zenodo.org/api/awards?q=" + quote(number, safe=''))
Expand Down

0 comments on commit d086789

Please sign in to comment.