Skip to content

Commit

Permalink
Merge pull request #6 from ARGOeu-Metrics/themiszamani-update-code
Browse files Browse the repository at this point in the history
Put a check for files.
  • Loading branch information
themiszamani authored Apr 12, 2022
2 parents 0d83d90 + c1facd3 commit 9506fa6
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions check_b2share.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,14 @@ def get_dict_from_url(url, verify_tls_cert=False, verbosity=False):

rec_with_files_url = None
for hit in search_results['hits']['hits']:
# Check if there are files in the record
if len(hit['files']) > 0:
# NTS: Could throw KeyError if there is something
# seriously wrong or B2SHARE REST API responses have
# changed.
rec_with_files_url = hit['links']['self']
break
if 'files' in hit:
# Check if there are files in the record
if len(hit['files']) > 0:
# NTS: Could throw KeyError if there is something
# seriously wrong or B2SHARE REST API responses have
# changed.
rec_with_files_url = hit['links']['self']
break

if rec_with_files_url:

Expand Down

0 comments on commit 9506fa6

Please sign in to comment.