Skip to content

Allow iterating PaginatedList by pages - #3603

Open
EnricoMi wants to merge 2 commits into
requester-rate-limit-overviewfrom
paginated-list-pages
Open

EnricoMi wants to merge 2 commits into
requester-rate-limit-overviewfrom
paginated-list-pages

Conversation

@EnricoMi

@EnricoMi EnricoMi commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

This allows to control when the next page is fetched.

@EnricoMi
EnricoMi added this pull request to stack #3604 November 5, 2026 14:53
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Test Results

β€‡β€‡β€ˆβ€‡β€‡9 files  ±  0β€‚β€ƒβ€‡β€‡β€ˆβ€‡β€‡9 suites  Β±0   5m 0s ⏱️ -25s
 1β€ˆ227 tests + 13   1β€ˆ227 βœ… + 13  0 πŸ’€ Β±0  0 ❌ Β±0 
15β€ˆ297 runsβ€Š +104  15β€ˆ296 βœ… +104  1 πŸ’€ Β±0  0 ❌ Β±0 

Results for commit 831783a. ± Comparison against base commit 00ac0a3.

♻️ This comment has been updated with latest results.

Enrico Minack and others added 2 commits November 5, 2026 21:45
PaginatedList now represents pages as Page[T] rather than list[T], and
PaginatedList.pages() iterates over individual pages rather than all
elements. Pages are fetched on demand and shared with iteration and
indexing, so no page gets fetched twice.

Page is a list subclass, so existing users of get_page() are not affected.
This prepares for providing Page.rate_limit from response headers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pages are mutable, so modifying a yielded page would otherwise affect later
calls to pages(). Add Page.copy(), as list.copy() returns a plain list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@EnricoMi
EnricoMi force-pushed the paginated-list-pages branch from 540fc58 to 831783a Compare November 5, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant