Skip to content

Conversation

@DuncanDHall
Copy link
Contributor

@DuncanDHall DuncanDHall commented Apr 3, 2023

Scrape can result in j where 'count': 0, 'total': None resulting in:
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Scrape can result in `j` where `count: 0, total: None` resulting in:
`TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'`
Comment on lines +156 to 158
num_found = int(j['total'] or 0)
if not self._num_found:
self._num_found = num_found
Copy link
Contributor

@cclauss cclauss Apr 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be awesome if we had an empty search test case that failed with the current code and passed with the proposed code.

The GitHub Actions tests have been updated so another push to the pull request should pass all GitHub Actions.

Please remove line 155 and then...

Suggested change
num_found = int(j['total'] or 0)
if not self._num_found:
self._num_found = num_found
num_found = num_found or int(j['total'] or 0)
self._num_found = self._num_found or num_found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants