Skip to content

Commit

Permalink
Patch search error
Browse files Browse the repository at this point in the history
Currently key error is thrown when elastic search returns no 'response' key in its json when we try to grab the num_found.
  • Loading branch information
DuncanDHall authored Aug 23, 2023
1 parent ee89550 commit 7eee5a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internetarchive/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def _advanced_search(self):
auth=self.auth,
**self.request_kwargs)
j = r.json()
num_found = int(j['response']['numFound'])
num_found = int(j.get('response', {}).get('numFound', 0))
if not self._num_found:
self._num_found = num_found
if j.get('error'):
Expand Down

0 comments on commit 7eee5a9

Please sign in to comment.