diff --git a/google/cloud/storage/bucket.py b/google/cloud/storage/bucket.py index febcfc608..7c16e4431 100644 --- a/google/cloud/storage/bucket.py +++ b/google/cloud/storage/bucket.py @@ -1054,6 +1054,15 @@ def list_blobs( :rtype: :class:`~google.api_core.page_iterator.Iterator` :returns: Iterator of all :class:`~google.cloud.storage.blob.Blob` in this bucket matching the arguments. + + Example: + List blobs in the bucket with user_project. + + >>> from google.cloud import storage + >>> client = storage.Client() + + >>> bucket = storage.Bucket("my-bucket-name", user_project='my-project') + >>> all_blobs = list(bucket.list_blobs()) """ extra_params = {"projection": projection} diff --git a/google/cloud/storage/client.py b/google/cloud/storage/client.py index 58c1dcbb8..ce178ee11 100644 --- a/google/cloud/storage/client.py +++ b/google/cloud/storage/client.py @@ -657,6 +657,15 @@ def list_blobs( Returns: Iterator of all :class:`~google.cloud.storage.blob.Blob` in this bucket matching the arguments. + + Example: + List blobs in the bucket with user_project. + + >>> from google.cloud import storage + >>> client = storage.Client() + + >>> bucket = storage.Bucket("my-bucket-name", user_project='my-project') + >>> all_blobs = list(client.list_blobs(bucket)) """ bucket = self._bucket_arg_to_bucket(bucket_or_name) return bucket.list_blobs(