Skip to content

fix: raise errors for non-2xx Static Maps responses - #16

Draft
illuminati1911 wants to merge 1 commit into
masterfrom
static-map-response-errors
Draft

illuminati1911 wants to merge 1 commit into
masterfrom
static-map-response-errors

Conversation

@illuminati1911

Copy link
Copy Markdown
Collaborator

Summary

The existing Static Maps response handler exposes error bodies as image bytes because it bypasses normal HTTP-status validation.

  • Validate HTTP status before returning an image iterator. Close non-2xx responses without consuming their bodies and raise HTTPError with the original status.
  • Preserve lazy binary streaming for successful responses and existing 500/503/504 retries; leave HTTP 429 retry policy unchanged.
  • Add behavioral regression coverage, exception documentation, and an unreleased changelog entry.

Fixes googlemaps#447. Related prior work: googlemaps#446.

Verification

Python 3.10.20 with Requests 2.34.2:

  • Focused Static Maps tests: 7 passed, 10 subtests passed.
  • Full suite: 109 passed, 10 subtests passed.
  • Real loopback HTTP reproduced the bug before the fix and verified immediate terminal errors, successful binary iterator output, transient-to-success retries, and transient-to-terminal errors afterward. No Google API calls or real credentials were used.
  • Full Sphinx 8.1.3 HTML build passed with warnings treated as errors. Browser inspection confirmed the exception documentation, iterator contract, exception link, and rendered changelog entry.
  • Repository distribution build/install script passed in a temporary source/environment; installed-package import was verified outside the checkout.

Regression coverage.

Statement coverage Upstream baseline This change
Total 88.67% 88.73%
Static Maps module 95.38% 95.65%

Verification limits

Python 3.5 and 3.7 are unavailable; the full multi-version CI matrix was not run. The documentation build used Python 3.10 rather than the configured Python 3.7. No Python support minimum changed. Existing setuptools packaging deprecation warnings remain.

@illuminati1911 illuminati1911 self-assigned this Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Static maps fail silently and produces malformed data

1 participant