首页 > 解决方案 > 如何在 Google AppEngine Python37 中获取凭据

问题描述

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

我正在尝试使用以下代码段获取凭据,但失败了。

任何人都能够进入credentialsGAE 标准 Python37 吗?

输入:

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

输出:

The App Engine APIs are not available

标签: pythongoogle-app-enginegoogle-cloud-platform

解决方案


将 App Engine Standard 与 python 3.7 一起使用时,没有任何 google.xxx 库可用。您必须自己构建或使用标准 Python 库。这适用于:auth, users, images, search, mail, taskqueue, memcache, urlfetch,deferred等,甚至是ndb数据存储接口。

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

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

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

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


推荐阅读