Skip to content

Commit

Permalink
better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
shadrach-tayo committed Jun 28, 2024
1 parent c26bd98 commit 3f77708
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Binary file modified .DS_Store
Binary file not shown.
16 changes: 10 additions & 6 deletions app/langchain_orcid2.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@ def published_metadata(doi, cremail, pyalexemail):
authors_info = []

for author in r['message']['author']:
full_name = author['given'] + ' ' + author['family']
if 'given' in author:
full_name = author['given'] + ' ' + author['family']
else:
full_name = author['name']
authors_info.append(full_name)

if authors_info:
Expand All @@ -211,11 +214,12 @@ def published_metadata(doi, cremail, pyalexemail):


refs = []
for i in r['message']['reference']:
try:
refs.append(i['DOI'])
except:
refs.append(f"{i['key']}, DOI not present")
if 'reference' in r['message']:
for i in r['message']['reference']:
try:
refs.append(i['DOI'])
except:
refs.append(f"{i['key']}, DOI not present")

url_link = r['message']['URL']

Expand Down

0 comments on commit 3f77708

Please sign in to comment.