I am trying to upload multiple files at once using the google cloud python api, and am having trouble with it. Below is my code:
client = storage.Client.from_service_account_json("path_to_json")
bucket = client.get_bucket(bucket_name)
with client.batch():
for i in range(10):
try:
blob = bucket.blob("my_blob")
blob.upload_from_filename("path_to_file",content_type="image/jpeg")
except Exception as e:
raise e
However, this is telling me that there are no deferred requests to make. I have tried doing it without client.batch()
and it works but is too slow. I was wondering if anyone has ever encountered this.
Thanks
According to this issue, the back-end API doesn't support batching "media" operations
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With