aiter_pages
Read one page at a time when you need its headers, warnings or cursor. The helper requests the next page as you iterate.
Signature
aiter_pages(fetch, /, *args, **kwargs) -> AsyncIterator[Response[Any]]Parameters
fetch- Cursor-based SDK list method. Pass the method without calling it.
*args, **kwargs- Arguments for that method, including filters and page size. The helper sends the next cursor and keeps the other arguments fixed.
Return value
Yields Response objects and stops when the response has no next cursor. The cursor can come from meta.next_cursor or the X-Next-Cursor header.
Errors
- Catch AeoError for a repeated cursor or a page count above the 10,000-page limit. Errors raised by the list method also reach the caller.
Python example
import asyncio
import os
from aeo_sdk import AsyncAeoClient, aiter_pages
async def main():
async with AsyncAeoClient(os.environ["AEO_API_KEY"], base_url=os.environ["AEO_API_BASE_URL"]) as client:
async for page in aiter_pages(client.v2_get_brands, limit=25):
print(page.status, page.next_cursor)
asyncio.run(main())See Python client setup for the environment variables, response properties and retry settings.