planet-client-python
planet-client-python copied to clipboard
have Session entirely handle paging
Is your feature request related to a problem? Please describe. It is awkward for clients to manage Paged subclasses (Orders, Subscriptions, etc).
Describe the solution you'd like
Change the code so that Session handles paging with a method with a signature something like
def page(response, links_key='_links', next_key = 'next', items_key='items') -> typing.AsyncGenerator[dict, None]
and the Paged object is instantiated and handled within page and the Paged class is moved to http as a private class that is exclusively used by Session.
Describe alternatives you've considered
Additional context https://github.com/planetlabs/planet-client-python/issues/706#issuecomment-1308070672