Seth Stokes
10/13/2025, 4:13 PMParallelizable incorrectly?
def raw_paginated_results(api: API, query: str) -> Parallelizable[dict]:
"""Paginate the results from the API.
a `nextPageToken` indicates more pages must be fetch.
Previously, in v2, split into batches from `total` `startAt` and `maxResults`.
"""
next_page, init_result = api.search(query, max_results=50)
yield init_result
while next_page:
next_page, result = api.search(query, max_results=50, params={"nextPageToken": next_page})
if result:
yield result
When I collect this I am getting a List[List[dict]] (where the outer list is just len of 1) instead of a List[dict].
Could this have something to do with the two yield statements?Stefan Krawczyk
10/14/2025, 4:15 PMresult and init_result areSeth Stokes
10/14/2025, 4:29 PMraw_paginated_results[0] got me where I wanted