【问题标题】:How to get credentials in Google AppEngine Python37如何在 Google AppEngine Python37 中获取凭据
【发布时间】:2019-01-18 19:52:54
【问题描述】:

我在 AppEngine Python3.7 标准中启动了新应用。

我正在尝试使用以下 sn-p 获取凭据,但它失败了。

任何人都能在 GAE 标准 Python37 中获得 credentials 吗?

输入:

from google.auth import app_engine
credentials = app_engine.Credentials()

输出:

The App Engine APIs are not available

【问题讨论】:

  • Dan,GAE 标准现已推出 Python 3.7!
  • @GAEfan - 好的,很高兴知道:)
  • @snakecharmerb 我正在尝试从 GAE py37 访问谷歌云构建 API

标签: python google-app-engine google-cloud-platform


【解决方案1】:

将 App Engine Standard 与 python 3.7 结合使用时,没有任何 google.xxx 库可用。您必须自己构建或使用标准 Python 库。这适用于:authusersimagessearchmailtaskqueuememcacheurlfetchdeferred 等,甚至是 @9876543界面。

对于数据存储,您可以使用 google-cloud-datastore 或某个第 3 方。

对于其他人,您使用标准 Python 库,例如:google.auth => rauth, google.appengine.api.memcache => python-memcached

在此处阅读更多信息:https://cloud.google.com/appengine/docs/standard/python3/python-differences

该页面建议使用 Google Identity Platform 或 Firebase 身份验证进行授权。

【讨论】:

  • 是的,与 python 2.7 相比有显着差异。 This guide 将是一个很好的起点。
  • 是的。添加到答案。
  • @GAEfan,感谢您的回答。我希望 GCP 将来能原生地提供这些功能。
  • 是的,我也是!此外,3.7 似乎很慢。启动一个新实例大约需要 8 秒。生产站点不可接受,IMO。
猜你喜欢
  • 2016-04-10
  • 1970-01-01
  • 2023-03-20
  • 2014-01-15
  • 1970-01-01
  • 2020-02-15
  • 2021-01-08
  • 1970-01-01
  • 2020-05-18
相关资源
最近更新 更多