Issue with maps.static_map() error handling #381
Labels
priority: p3
Desirable enhancement or fix. May not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Is your feature request related to a problem? Please describe.
Because
maps.static_map()
returnsiter_content()
of the request directly, exceptions not caught byclient._request()
may result in it returning the raw HTTP text of an error response without any indication of the error. See "Additional Context" below for examples of content received.Describe the solution you'd like
I think it'd be a good idea to modify
client._request()
to handle unretryable HTTP errors as well. Perhaps belowgoogle-maps-services-python/googlemaps/client.py
Lines 295 to 299 in 5253cbc
Something like
could be added
Describe alternatives you've considered
My current hacky solution is to use
imghdr
to check if the saved bytes constitute a valid image file:Additional context
Examples of content received from erroneous calls to
static_map()
The text was updated successfully, but these errors were encountered: