Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PaginatedResponse not working correctly #47

Closed
iamkubi opened this issue Jan 10, 2022 · 3 comments
Closed

PaginatedResponse not working correctly #47

iamkubi opened this issue Jan 10, 2022 · 3 comments

Comments

@iamkubi
Copy link
Owner

iamkubi commented Jan 10, 2022

The prints in this code have the same result:

    response = api.nodes.list_nodes()
    for page in response:
        print ('page: {}'.format(page))
        for node in page:
            print('node: {}'.format(node))

Must be a bug in PaginatedResponse.

@iamkubi
Copy link
Owner Author

iamkubi commented Sep 12, 2022

This is more or less intended. When creating an iterator of a PaginatedResponse it re-initializes the data and the string method returns the same thing. To iterate over the items in a paginated response it needs to loop over page.data.

@iamkubi iamkubi closed this as completed Sep 12, 2022
@iamkubi iamkubi reopened this Sep 25, 2022
@iamkubi
Copy link
Owner Author

iamkubi commented Sep 25, 2022

14 days ago me was not very bright. Jan 10th me knew what I was talking about.

@iamkubi
Copy link
Owner Author

iamkubi commented Sep 25, 2022

Fixed by b81b276

@iamkubi iamkubi closed this as completed Sep 25, 2022
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

No branches or pull requests

1 participant