Commit 0d02181
Raise on mid-pagination 429 instead of silently truncating
`_walk_pages` and `get_stats_data`'s pagination loops have, since
PR #273, logged failures correctly but preserved the "best effort"
behavior of returning whatever pages had been collected when a page
mid-walk failed. For 429 specifically that's a data-correctness
footgun: a rate-limit hit means rows are *definitively* missing
(not "the upstream had a transient glitch"), and the caller can
retry once the rate-limit window resets — but only if they know
the result was incomplete. Silently handing back a short DataFrame
hides that.
The loops now re-raise the `RuntimeError` raised by
`_raise_for_non_200` when the failing response carried HTTP 429.
For transient network errors and 5xx the existing best-effort
return-partial behavior is preserved (so an upstream blip on the
last page of a long walk doesn't lose the prior pages). Two new
tests assert the new contract:
- `test_walk_pages_raises_on_mid_pagination_429`
- `test_get_stats_data_raises_on_mid_pagination_429`
Existing 5xx tests still pass — proves the network/5xx path is
unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 36866a0 commit 0d02181
3 files changed
Lines changed: 52 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
650 | | - | |
651 | | - | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
652 | 656 | | |
653 | 657 | | |
654 | 658 | | |
| |||
694 | 698 | | |
695 | 699 | | |
696 | 700 | | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
697 | 707 | | |
698 | 708 | | |
699 | 709 | | |
| |||
1161 | 1171 | | |
1162 | 1172 | | |
1163 | 1173 | | |
| 1174 | + | |
| 1175 | + | |
1164 | 1176 | | |
1165 | 1177 | | |
1166 | 1178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
166 | 187 | | |
167 | 188 | | |
168 | 189 | | |
| |||
236 | 257 | | |
237 | 258 | | |
238 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
239 | 275 | | |
240 | 276 | | |
241 | 277 | | |
| |||
0 commit comments