Skip to content

    iter_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

    iter_pages(fetch, /, *args, **kwargs) -> Iterator[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 os
    from aeo_sdk import AeoClient, iter_pages
    
    with AeoClient(os.environ["AEO_API_KEY"], base_url=os.environ["AEO_API_BASE_URL"]) as client:
        for page in iter_pages(client.v2_get_brands, limit=25):
            print(page.status, page.next_cursor)

    See Python client setup for the environment variables, response properties and retry settings.