Skip to content

Commit

Permalink
Merge pull request #171 from yaron-cider/patch-1
Browse files Browse the repository at this point in the history
Better error handling
  • Loading branch information
achillean authored Jul 9, 2022
2 parents 8d2630e + 5366237 commit f181eae
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions shodan/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ def _request(self, function, params, service='shodan', method='get'):
raise APIError(error)
elif data.status_code == 403:
raise APIError('Access denied (403 Forbidden)')
elif data.status_code == 502:
raise APIError('Bad Gateway (502)')

# Parse the text into JSON
try:
Expand Down

0 comments on commit f181eae

Please sign in to comment.