Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bb46c2f

Browse filesBrowse files
authored
Update list blob samples
1 parent 599d096 commit bb46c2f
Copy full SHA for bb46c2f

File tree

Expand file treeCollapse file tree

1 file changed

+2
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-6
lines changed

‎storage/cloud-client/snippets.py

Copy file name to clipboardExpand all lines: storage/cloud-client/snippets.py
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,7 @@ def list_buckets():
113113
def list_blobs(bucket_name):
114114
"""Lists all the blobs in the bucket."""
115115
storage_client = storage.Client()
116-
bucket = storage_client.get_bucket(bucket_name)
117-
118-
blobs = bucket.list_blobs()
116+
blobs = storage_client.list_blobs(bucket_name)
119117

120118
for blob in blobs:
121119
print(blob.name)
@@ -144,9 +142,7 @@ def list_blobs_with_prefix(bucket_name, prefix, delimiter=None):
144142
145143
"""
146144
storage_client = storage.Client()
147-
bucket = storage_client.get_bucket(bucket_name)
148-
149-
blobs = bucket.list_blobs(prefix=prefix, delimiter=delimiter)
145+
blobs = storage_client.list_blobs(bucket_name, prefix=prefix, delimiter=delimiter)
150146

151147
print('Blobs:')
152148
for blob in blobs:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.