Skip to content

Commit 9469f5d

Browse files
authored
docs: clarify list_blobs usage (#866)
1 parent dd47bf0 commit 9469f5d

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

google/cloud/storage/client.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,8 @@ def list_blobs(
12691269
12701270
Returns:
12711271
Iterator of all :class:`~google.cloud.storage.blob.Blob`
1272-
in this bucket matching the arguments.
1272+
in this bucket matching the arguments. The RPC call
1273+
returns a response when the iterator is consumed.
12731274
12741275
As part of the response, you'll also get back an iterator.prefixes entity that lists object names
12751276
up to and including the requested delimiter. Duplicate entries are omitted from this list.

samples/snippets/storage_list_files.py

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def list_blobs(bucket_name):
2929
# Note: Client.list_blobs requires at least package version 1.17.0.
3030
blobs = storage_client.list_blobs(bucket_name)
3131

32+
# Note: The call returns a response only when the iterator is consumed.
3233
for blob in blobs:
3334
print(blob.name)
3435

samples/snippets/storage_list_files_with_prefix.py

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def list_blobs_with_prefix(bucket_name, prefix, delimiter=None):
5353
# Note: Client.list_blobs requires at least package version 1.17.0.
5454
blobs = storage_client.list_blobs(bucket_name, prefix=prefix, delimiter=delimiter)
5555

56+
# Note: The call returns a response only when the iterator is consumed.
5657
print("Blobs:")
5758
for blob in blobs:
5859
print(blob.name)

0 commit comments

Comments
 (0)