【问题标题】:equivalent of python boto for google storage相当于用于谷歌存储的 python boto
【发布时间】:2016-02-01 17:19:24
【问题描述】:

我正在寻找使用 python 脚本 (.py) 向谷歌存储桶上传或下载文件的最简单方法。

对于Amazon S3,有优秀的包boto,谷歌存储有类似的吗?

请注意,我尝试了以下代码:

from boto import connect_gs      

gs_conn = connect_gs(gs_access_key_id='xxxxxxxxxxxxxxxxxxxxxxxxx',
                     gs_secret_access_key='xxxxxxxxxxxxxxxxxxxxxxxxxxx')
bucket = gs_conn.get_bucket('gs://xxxxxxxxxxxxxxxxx')
keys = bucket.get_all_keys()
for key in keys:
    print(key)

进程卡住了,没有错误,但没有列出任何内容。

【问题讨论】:

  • 我相信 boto 也适用于 Google Cloud Storage。或者,也许他们在 API 首次引入后就对其进行了更改?
  • 我更新了我的问题
  • “请注意,这个文件是先验的,不是 json 或 xml,所以我不能使用这些 API” 嗯。 API 的语言与您要存储的文件的有效负载完全无关。

标签: python amazon-s3 google-cloud-storage boto


【解决方案1】:

Google 为 boto 编写了一个与 Google Cloud Storage 配合使用的插件:gcs-oauth2-boto-plugin。

Google 写了一个page 来说明如何使用该插件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-23
    • 1970-01-01
    • 2013-11-24
    • 1970-01-01
    相关资源
    最近更新 更多