Skip to content

Instantly share code, notes, and snippets.

@jsj14
Created February 3, 2022 12:57
Show Gist options
  • Save jsj14/430d35731977eb49a06e7e6e120e415b to your computer and use it in GitHub Desktop.
Save jsj14/430d35731977eb49a06e7e6e120e415b to your computer and use it in GitHub Desktop.
upload data from memory to gcs
def upload_blob(bucket_name, source_data, destination_blob_name):
"""Uploads a file to the bucket."""
print('function upload_blob called')
bucket = storage_client.get_bucket(bucket_name)
blob = bucket.blob(destination_blob_name)
blob.upload_from_string(source_data)
print('File {} uploaded to {}.'.format(destination_blob_name, bucket_name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment