【问题标题】:Google Cloud Storage return status 404 Not Found even though object exists?即使对象存在,Google Cloud Storage 返回状态 404 Not Found?
【发布时间】:2014-04-22 02:01:12
【问题描述】:

我有一个脚本,可以将照片上传到谷歌计算引擎进行处理,将其保存在谷歌云存储中,然后以我发送到应用引擎应用程序以进行读取的路径进行响应...使用 gsutil 进行测试cp 命令显示图片已正确保存到 GCS,因为 cp 命令总能找到它。

但是很多时候应用引擎在我发送路径时找不到照片,返回一个:

NotFoundError:预期来自 Google 存储的状态 [200]。但得到状态 404

有什么想法吗?

【问题讨论】:

  • 很多次?语言?你设置了 RetryParams 吗?
  • 只有异常重试,如何设置重试参数,我用的不是json api而是google存储库,代码是这样的:gcs_file = gcs.open(str (ss.h_photo)) x = gcs_file.read() gcs_file.close()
  • 顺便说一句。我不完全理解你的代码。 str() 和桶呢。如果您使用 Python 和 App Engine,这是我的:gist.github.com/voscausa/9541133
  • 太棒了,谢谢你解决了它,str只是为了确保我将路径作为字符串传递......但它确实包含存储桶。

标签: google-app-engine google-cloud-storage google-compute-engine


【解决方案1】:

感谢 Voscausa,您可以通过使用足够的参数简单地解决问题:

https://developers.google.com/appengine/docs/python/googlecloudstorageclient/retryparams_class

【讨论】:

    猜你喜欢
    • 2015-01-09
    • 1970-01-01
    • 2016-02-10
    • 2016-03-16
    • 1970-01-01
    • 2021-06-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多