Commit adb6629
fix(waterdata): make get_ratings resilient and stop truncating results (#304)
Two reliability issues in the ratings getter:
1. The per-feature download loop caught only (httpx.HTTPError, ValueError,
OSError), but _download_and_parse -> _raise_for_non_200 raises the module's
typed errors (RateLimited / ServiceUnavailable / RuntimeError, all
RuntimeError subclasses), and a feature missing its data asset raises
LookupError. So one rate-limited / failed / malformed feature aborted the
entire multi-site call instead of being logged and skipped. Broadened the
except to cover RuntimeError and LookupError.
2. _search sent `limit` verbatim and returned only the first page, silently
truncating large result sets despite the docstring. It now clamps the page
size to the service max (10,000) and follows the STAC `next` link until
exhausted, returning all matching features. (Behavior change for the narrow
case it fixes: >1-page queries, or small explicit `limit`s, now return all
matches; common default queries are unchanged.)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 0cb38d2 commit adb6629
1 file changed
Lines changed: 41 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
188 | 199 | | |
189 | 200 | | |
190 | 201 | | |
| |||
229 | 240 | | |
230 | 241 | | |
231 | 242 | | |
232 | | - | |
233 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
234 | 250 | | |
235 | 251 | | |
236 | 252 | | |
237 | 253 | | |
238 | 254 | | |
239 | 255 | | |
240 | 256 | | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
250 | 279 | | |
251 | 280 | | |
252 | 281 | | |
| |||
0 commit comments