From 792b21fd2263b518d56f79cab6a4a1bb06c6e4e7 Mon Sep 17 00:00:00 2001 From: HemangChothani <50404902+HemangChothani@users.noreply.github.com> Date: Mon, 18 May 2020 22:04:25 +0530 Subject: [PATCH] fix(storage): add documentaion of list_blobs with user project (#147) --- google/cloud/storage/bucket.py | 9 +++++++++ google/cloud/storage/client.py | 9 +++++++++ 2 files changed, 18 insertions(+) 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(