【发布时间】:2018-07-04 18:43:40
【问题描述】:
我正在尝试从一系列 URL 直接上传到 Google Cloud Storage。我一直在尝试在这里实现解决方案: How to upload an image from web into Google Cloud Storage?
特别是,每当我尝试使用 cloudstorage 模块打开文件时,
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)
我收到以下错误:
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'
我已经尝试在隔离环境中安装 cloudstorage,但仍然没有成功。
根据下面的参考,cloudstorage.open() 存在于 https://cloud.google.com/appengine/docs/standard/python/googlecloudstorageclient/functions
知道问题出在哪里吗?
谢谢!
【问题讨论】:
-
也许可以在Write a CSV to store in Google Cloud Storage查看一个工作示例。
标签: python google-app-engine cloud-storage