Tao Bian
11/15/2021, 4:28 PMKevin Kho
from gcloud import storage
client = storage.Client()
bucket = client.get_bucket('<your-bucket-name>')
filename = "%s/%s" % (folder, filename)
blob = bucket.blob(filename)
# Uploading from local file without open()
blob.upload_from_filename('photo.jpg')
If it does, then we can wrap it in a task and subclass that existing Upload taskTao Bian
11/15/2021, 4:39 PMKevin Kho
@task
def upload(...):
from gcloud import storage
client = storage.Client()
bucket = client.get_bucket('<your-bucket-name>')
filename = "%s/%s" % (folder, filename)
blob = bucket.blob(filename)
blob.upload_from_filename('photo.jpg')
or you could use subclass and use the code here