Created
July 21, 2020 15:20
-
-
Save armindocachada/e2855ef43dd9c1a84c6675454038a7ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def upload_blob(bucket_name, source_file_name, destination_blob_name): | |
"""Uploads a file to the bucket.""" | |
# bucket_name = "your-bucket-name" | |
# source_file_name = "local/path/to/file" | |
# destination_blob_name = "storage-object-name" | |
storage_client = storage.Client() | |
bucket = storage_client.bucket(bucket_name) | |
blob = bucket.blob(destination_blob_name) | |
blob.upload_from_filename(source_file_name) | |
print( | |
"File {} uploaded to {}.".format( | |
source_file_name, destination_blob_name | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment