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 26ce641

Browse filesBrowse files
authored
Add region tag to upload_blob snippet (GoogleCloudPlatform#1671)
1 parent 81f7f17 commit 26ce641
Copy full SHA for 26ce641

File tree

Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed

‎storage/cloud-client/snippets.py

Copy file name to clipboardExpand all lines: storage/cloud-client/snippets.py
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@
2525
import datetime
2626
import pprint
2727

28+
# [START storage_upload_file]
2829
from google.cloud import storage
2930

31+
# [END storage_upload_file]
32+
3033

3134
def create_bucket(bucket_name):
3235
"""Creates a new bucket."""
@@ -144,6 +147,7 @@ def list_blobs_with_prefix(bucket_name, prefix, delimiter=None):
144147
print(prefix)
145148

146149

150+
# [START storage_upload_file]
147151
def upload_blob(bucket_name, source_file_name, destination_blob_name):
148152
"""Uploads a file to the bucket."""
149153
storage_client = storage.Client()
@@ -155,6 +159,7 @@ def upload_blob(bucket_name, source_file_name, destination_blob_name):
155159
print('File {} uploaded to {}.'.format(
156160
source_file_name,
157161
destination_blob_name))
162+
# [END storage_upload_file]
158163

159164

160165
def upload_blob_with_kms(bucket_name, source_file_name, destination_blob_name,

0 commit comments

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