问题描述
我在 AppEngine Python3.7 标准中启动了新应用.
I started new app in AppEngine Python3.7 stadard.
我正在尝试使用以下代码段获取凭据,但失败了.
I am trying to get credentials using the following snippet, but its failing.
任何人都可以在 GAE 标准 Python37 中获得 credentials
?
Anybody able to get credentials
in GAE standard Python37 ?
输入:
from google.auth import app_engine
credentials = app_engine.Credentials()
输出:
The App Engine APIs are not available
推荐答案
在 Python 3.7 中使用 App Engine Standard 时,没有任何 google.xxx 库可用.您必须构建自己的或使用标准 Python 库.这适用于:auth
、users
、images
、search
、mail
、taskqueue
、memcache
、urlfetch
、deferred
等,甚至 ndb
数据存储界面.
When using App Engine Standard with python 3.7, none of the google.xxx libraries are available. You have to build your own, or use standard Python libraries. This goes for: auth
, users
, images
, search
, mail
, taskqueue
, memcache
, urlfetch
, deferred
, etc., and even the ndb
datastore interface.
对于数据存储区,您使用 google-cloud-datastore
或某些第三方.
For datastore, you use google-cloud-datastore
or some 3rd party.
对于其他人,您使用标准 Python 库,例如:google.auth
=> rauth
、google.appengine.api.memcache
=> python-memcached
For others, you use a standard Python library, e.g.: google.auth
=> rauth
, google.appengine.api.memcache
=> python-memcached
在此处阅读更多信息:https://cloud.google.com/appengine/docs/standard/python3/python-differences
该页面建议使用 Google Identity Platform 或 Firebase 身份验证进行授权.
That page recommends Google Identity Platform or Firebase Authentication to do authorization.
这篇关于如何在 Google AppEngine Python37 中获取凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,WP2