python - 是否可以使用 boto 从 Google App Engine 中的 S3 读取文件?

标签 python google-app-engine amazon-s3 amazon-web-services boto

我想在 Google App Engine 的沙箱中操作存储在 S3 中的 pickled python 对象。我使用 boto 的 documentation 中的建议:

from boto.s3.connection import S3Connection

from boto.s3.key import Key

conn = S3Connection(config.key, config.secret_key)
bucket = conn.get_bucket('bucketname')
key = bucket.get_key("picture.jpg")
fp = open ("picture.jpg", "w")
key.get_file (fp)

但这需要我写入一个文件,该文件在 GAE 沙箱中显然不符合标准。

我该如何解决这个问题? 非常感谢任何帮助

最佳答案

您根本不需要写入文件或 StringIO。您可以调用 key.get_contents_as_string() 以字符串形式返回键的内容。 key 的文档是 here .

关于python - 是否可以使用 boto 从 Google App Engine 中的 S3 读取文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3948391/

相关文章:

python - 在 Python 中验证文本文件中的用户名和密码

angular - 使用 Azure AD 保护单页 Google 应用引擎 Web 应用

google-app-engine - Go 的运行库文档过时了?

go - 在golang中将多部分文件转换为图像对象

ios - 适用于 iOS 的 AWS S3 SDK v2 - 将图像文件下载到 UIImage

python - cx_Oracle LDAP 连接字符串语法

Python:从列表中删除很多项目

javascript - 从 NodeJS 缓冲区到 S3 文件

python - 删除不确定的子串

python - 在 Python Tools for Visual Studio 中调试 GAE