Morning, could you please advise if I could be def...
# hamilton-help
s
Morning, could you please advise if I could be defining this while loop for
Parallelizable
incorrectly?
Copy code
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?
s
@Seth Stokes I think you need to inspect what
result
and
init_result
are
s
Ok thanks I’ll try that. That’s probably the case since
raw_paginated_results[0]
got me where I wanted