-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return response body for errors #193
Comments
You should be able to access the specific error message from the |
The contents of the shodan-python/shodan/client.py Lines 376 to 379 in 9ed7496
For some status codes, the Shodan response body will contain more detailed information that is useful to have and return to the end user. |
I think that's because for some of those responses the body isn't JSON but you're right, we should use the JSON error message if available as that is typically more precise. |
When the Shodan HTTP API returns an error status code, such as 403 Forbidden, this library will only return a
APIError
object.However, the HTTP response will usually also include data in the response body, such as
{"error": "Requires membership or higher to access"}
. This data is currently ignored and not available through the library.It would be useful if this response body is also made available by the library, for example to show a more informative error message to the end user.
The text was updated successfully, but these errors were encountered: