There is two ways to iterate:
for path in file_system_client.get_paths():
will iterate all paths, not notion of pages
for page in file_system_client.get_paths().by_pages():
will iterate on the pages, that contains paths
This means the first one is returning an iterator of path
pathlist = []
for path in paths: # Should iterate ALL
pathlist.append(path.name)
While the second will iterate pages of paths, therefore you would need two loops. This one is useful if you build a webpage for instance, and you need result by page (like a Google/Bing result, etc.)
pathlist = []
for page in file_system_client.get_paths().by_pages():
for path in page:
pathlist.append(path.name)
ItemPaged
is an iterator, meaning you can consume it with everything that takes an iterator in input. You don't need a for
at all
pathlist = list(file_system_client.get_paths()) # list() consumes the iterator to a list
This is for the general behavior of those classes.
Now I understand from your post that you would expect to get more than 5000 paths, which I assume means you know you have more than that in your account. If that's indeed the case, it deserves a bug investigation as the first syntax should return all, and not only the first page, please open an issue here: https://github.com/Azure/azure-sdk-for-python/issues
(I work at MS in the Azure Python SDK team)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…