Add async iteration to v2 list auto-pagination 🪿✨ - #1874
Merged
Conversation
Committed-By-Agent: goose
jar-stripe
marked this pull request as ready for review
August 10, 2026 18:27
jar-stripe
requested review from
zacchua-stripe
and
a lite review from Copilot
and removed request for
a team
August 10, 2026 18:27
There was a problem hiding this comment.
Pull request overview
This PR updates Stripe Python’s v2 ListObject.auto_paging_iter() to support both synchronous (for) and asynchronous (async for) iteration, aligning v2 list auto-pagination behavior with the existing dual sync/async iteration pattern used elsewhere in the library (via AnyIterator).
Changes:
- Wrap v2
ListObject.auto_paging_iter()inAnyIterator, adding an awaited async pagination path for subsequent page fetches. - Add async test coverage for one-page and multi-page iteration, including API key forwarding through pagination.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
stripe/v2/_list_object.py |
Switch auto_paging_iter() to return AnyIterator, implementing _auto_paging_iter_async() to fetch next pages via _request_async. |
tests/api_resources/test_list_object_v2.py |
Add pytest.mark.anyio tests covering async iteration for one page, two pages, and API key forwarding across pages. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
jar-stripe
enabled auto-merge (squash)
August 10, 2026 18:43
xavdid
approved these changes
Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why?
V2 list auto-pagination returned a synchronous generator, so
async forraisedTypeError. This brings v2 list results in line with the existing dual sync/async iteration behavior.What?
AnyIteratorand add an async pagination path that awaits subsequent page requests.See Also
http://go/j/RUN_DEVSDK-2687
Changelog
async forsupport to v2ListObject.auto_paging_iter().