msgraph-sdk-python-core
msgraph-sdk-python-core copied to clipboard
Developers should be able to consumed paged collections easily (Page iterator support)
For a variety of reasons, collections of entities are often split into pages and each page is returned with a URL to the next page. Sometimes, page granularity provided by the API does not match the requirements of the consumer. This task aims to simplify the life of consumers of paged collections through implementing the page iterator.
Design requirements and specifications here
would love to see such a feature, either as an iterator or as an optional argument for the requesting function!
edit: meanwhile, my workaround for collecting all the data (does not respect any memory limitations etc.)
client = GraphClient(...)
results = [client.get('/users')]
# Handle Next Link
while results[-1].json().get('@odata.nextLink'):
page_result = client.get(results[-1].json().get('@odata.nextLink'))
results.append(page_result)
@shemogumbe to close this issue and link it to the closed PR.
thanks for reporting this issue, we have since released a new version of the SDK which this issue doesn't apply to. We encourage you to migrate to the new version and open a new issue if you still need help