You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Non-OGC getter error coherence + safe cleanups. All public signatures, kwargs
(incl. the upstream-driven Samples camelCase), and return shapes are unchanged
— the only behavior change is the exception TYPE on HTTP errors.
Error coherence:
- Route the direct-httpx getters (get_samples, get_samples_summary, get_codes,
ratings._search/_download_and_parse) through the module's typed
_raise_for_non_200 instead of a bare response.raise_for_status(), so a 429
raises RateLimited and a 5xx raises ServiceUnavailable (with Retry-After and
USGS-aware messages) — the same typed errors the OGC/stats path already
raises. NOTE: this changes the exception type from httpx.HTTPStatusError;
flagged for review.
Safe cleanups:
- Extract `_get_samples_csv` and call it from get_samples/get_samples_summary
(collapses the duplicated GET + read_csv tail).
- Fix get_channel docstring drift: channel_flow was labeled as units (it's the
discharge value), channel_flow_unit was undocumented, and measurement_type
carried last_modified's pasted RFC-3339 block.
- _format_api_dates: resolve the local timezone only after the all-NA /
duration / interval guards (skip the lookup when it's discarded).
Tests: add typed-error regression tests (429 -> RateLimited, 5xx ->
ServiceUnavailable). 118 samples/ratings/utils tests pass; ruff clean.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments