Skip to content

Commit 792b21f

Browse files
fix(storage): add documentaion of list_blobs with user project (#147)
1 parent ddad20b commit 792b21f

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

google/cloud/storage/bucket.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,15 @@ def list_blobs(
10541054
:rtype: :class:`~google.api_core.page_iterator.Iterator`
10551055
:returns: Iterator of all :class:`~google.cloud.storage.blob.Blob`
10561056
in this bucket matching the arguments.
1057+
1058+
Example:
1059+
List blobs in the bucket with user_project.
1060+
1061+
>>> from google.cloud import storage
1062+
>>> client = storage.Client()
1063+
1064+
>>> bucket = storage.Bucket("my-bucket-name", user_project='my-project')
1065+
>>> all_blobs = list(bucket.list_blobs())
10571066
"""
10581067
extra_params = {"projection": projection}
10591068

google/cloud/storage/client.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,15 @@ def list_blobs(
657657
Returns:
658658
Iterator of all :class:`~google.cloud.storage.blob.Blob`
659659
in this bucket matching the arguments.
660+
661+
Example:
662+
List blobs in the bucket with user_project.
663+
664+
>>> from google.cloud import storage
665+
>>> client = storage.Client()
666+
667+
>>> bucket = storage.Bucket("my-bucket-name", user_project='my-project')
668+
>>> all_blobs = list(client.list_blobs(bucket))
660669
"""
661670
bucket = self._bucket_arg_to_bucket(bucket_or_name)
662671
return bucket.list_blobs(

0 commit comments

Comments
 (0)