Comments (1)
Hi folks,
I dug into the Page iterator and found that max_results is strict in the total number of results to retrieve. However, I think there's a usability issue here in the case you want to limit the number of items per page while retrieving all items.
Given the expectation is set in the code, moving forward with the PR that exists makes sense for now because it would require adding support for this path.
The workaround for this is the following:
from google.cloud import storage
storage_client = storage.Client()
bucket = storage_client.bucket("bucket-name")
blobs = bucket.list_blobs(max_results=3)
start = False
while blobs.next_page_token or start is False:
for blob in blobs:
print(blob.name)
blobs = bucket.list_blobs(max_results=3, page_token=blobs.next_page_token)
start = True
@crwilcox this is a usability issue because it doesn't fully expose the GCS API behavior when setting maxResults.
from python-storage.
Related Issues (20)
- tests.system.test_transfer_manager: test_upload_chunks_concurrently_with_kms failed HOT 1
- Random "Project was not passed and could not be determined from the environment" HOT 3
- tests.system.test__signing: test_create_signed_resumable_upload_url_v2 failed HOT 1
- tests.system.test__signing: test_create_signed_resumable_upload_url_v4 failed HOT 1
- tests.system.test_blob: test_large_file_write_from_stream failed HOT 1
- tests.system.test_blob: test_large_file_write_from_stream_w_checksum failed HOT 1
- tests.system.test_blob: test_large_file_write_from_stream_w_failed_checksum failed HOT 1
- tests.system.test_blob: test_blob_upload_w_gzip_encoded_download_raw failed HOT 1
- tests.system.test_blob: test_blob_upload_from_file_resumable_with_generation failed HOT 1
- tests.system.test_blob: test_blob_update_storage_class_small_file failed HOT 1
- tests.system.test_blob: test_blob_update_storage_class_large_file failed HOT 1
- tests.system.test_fileio: test_blobwriter_and_blobreader failed HOT 1
- tests.system.test_fileio: test_blobwriter_and_blobreader_text_mode failed HOT 1
- tests.system.test_transfer_manager: test_upload_many_with_threads_and_file_objs failed HOT 1
- tests.system.test_transfer_manager: test_download_chunks_concurrently failed HOT 1
- tests.system.test_transfer_manager: test_upload_chunks_concurrently failed HOT 1
- tests.system.test_transfer_manager: test_upload_chunks_concurrently_with_metadata failed HOT 1
- tests.system.test_transfer_manager: test_upload_chunks_concurrently_with_content_encoding failed HOT 1
- tests.system.test_transfer_manager: test_upload_chunks_concurrently_with_encryption_key failed HOT 1
- Resumable file uploads crashes with 400 error from API HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-storage.