Skip to content
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

Static maps fail silently and produces malformed data #447

Open
vakker opened this issue Sep 26, 2022 · 0 comments
Open

Static maps fail silently and produces malformed data #447

vakker opened this issue Sep 26, 2022 · 0 comments
Assignees
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@vakker
Copy link

vakker commented Sep 26, 2022

Please be sure to include as much information as possible:

Environment details

  1. Specify the API at the beginning of the title (for example, "Places: ..."): static maps
  2. OS type and version
  3. Library version and other environment information: latest master

Steps to reproduce

  1. Request static maps that fail (e.g. wrong API key)
  2. Iterate the response

Code example

client = googlemaps.Client(key="asd")
response = client.static_map(
                size=(640, 640),
                zoom=zoom,
                center=center,
                maptype="satellite",
                format="png",
                scale=1,
            )

for r in response:
    print(r)

Output

b'T' b'he ' b'G' b'oo' b'gl' b'e ' b'M' b'ap' b's ' b'P' b'la' b't' b'fo' b'rm' b' s' b'er' b've' b'r ' b're' b'je' b'ct' b'ed' b' ' b'yo' b'u' b'r re' b'q' b'ue' b'st' b'. ' b'T' b'he ' b'pr' b'ov' b'i' b'd' b'ed ' b'AP' b'I ' b'k' b'ey' b' i' b's ' b'i' b'nv' b'a' b'li' b'd.' b' '

Since the static maps function passes in it's own extract_body function to _request, the error checking doesn't happen.
See here.

Possible solution: #446

@vakker vakker added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants