I am trying to upload directly to Google Cloud Storage from a series of URLs. I have been trying to implement the solution form here: How to upload an image from web into Google Cloud Storage?
In particular, whenever I try to open a file using cloudstorage module,
options={'x-goog-acl': 'public-read', 'Cache-Control': 'private, max-age=0, no-transform'}
with gcs.open(filename, 'w', content_type=content_type, options=options) as f:
f.write(image_bytes)
I get the following error:
AttributeError Traceback (most recent call last)
<ipython-input-8-dec1a5d39c62> in <module>()
18
19 options={'x-goog-acl': 'public-read', 'Cache-Control': 'private, max-age=0, no-transform'}
---> 20 with gcs.open(filename, 'w', content_type=content_type, options=options) as f:
21 f.write(image_bytes)
22 f.close()
AttributeError: 'module' object has no attribute 'open'
I have already tried installing cloudstorage in an isolated environment but still had no luck.
Based on the reference below, cloudstorage.open() exist in https://cloud.google.com/appengine/docs/standard/python/googlecloudstorageclient/functions
Any idea where the problem could be?
Thanks!