googlemaps / googlemaps/google-maps-services-python

Static maps fail silently and produces malformed data

Đang mở
#447 0 bình luận 0 reaction 1 người được giao Được @wangela nhận Xem trên GitHub
triage me type: bug
Ngôn ngữ chính
Python
Star
5k
Fork
1.4k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

```python
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](https://github.com/googlemaps/google-maps-services-python/blob/a93b3c0fe1ec4680fbb34fc29ac8714b9a8c7da4/googlemaps/client.py#L312).

Possible solution: #446

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.