Skip to content

Add async iteration to v2 list auto-pagination 🪿✨ - #1874

Merged
jar-stripe merged 1 commit into
masterfrom
fix-v2-async-auto-pagination
Aug 10, 2026
Merged

Add async iteration to v2 list auto-pagination 🪿✨#1874
jar-stripe merged 1 commit into
masterfrom
fix-v2-async-auto-pagination

Conversation

@jar-stripe

@jar-stripe jar-stripe commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Why?

V2 list auto-pagination returned a synchronous generator, so async for raised TypeError. This brings v2 list results in line with the existing dual sync/async iteration behavior.

What?

  • Wrap v2 auto-pagination in AnyIterator and add an async pagination path that awaits subsequent page requests.
  • Add coverage for one-page and multi-page async iteration and API key forwarding.

See Also

http://go/j/RUN_DEVSDK-2687

Changelog

  • Adds async for support to v2 ListObject.auto_paging_iter().

@jar-stripe
jar-stripe marked this pull request as ready for review August 10, 2026 18:27
@jar-stripe
jar-stripe requested a review from a team as a code owner August 10, 2026 18:27
@jar-stripe
jar-stripe requested review from zacchua-stripe and a lite review from Copilot and removed request for a team August 10, 2026 18:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() in AnyIterator, 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
jar-stripe enabled auto-merge (squash) August 10, 2026 18:43
@jar-stripe
jar-stripe merged commit fd2313e into master Aug 10, 2026
19 checks passed
@jar-stripe
jar-stripe deleted the fix-v2-async-auto-pagination branch August 10, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants