python - GAE : remote_api and Application Default Credentials

标签 python google-app-engine google-cloud-datastore

从今天开始,我一直在使用 remote_api (python) 访问 GAE 上的数据存储。

我通常做remote_api_shell.py -s <mydomain> .

今天试了一下,还是失败了,错误是:

oauth2client.client.ApplicationDefaultCredentialsError: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

我不明白为什么它会问我。

整个输出是这样的

stefano@~/gc$ remote_api_shell.py -s ....
Traceback (most recent call last):
  File "/usr/local/bin/remote_api_shell.py", line 133, in <module>
    run_file(__file__, globals())
  File "/usr/local/bin/remote_api_shell.py", line 129, in run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/remote_api_shell.py", line 157, in <module>
    main(sys.argv)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/remote_api_shell.py", line 153, in main
    appengine_rpc.HttpRpcServer)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/remote_api_shell.py", line 74, in remote_api_shell
    secure=secure)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 734, in ConfigureRemoteApiForOAuth
    credentials = client.GoogleCredentials.get_application_default()
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/oauth2client/oauth2client/client.py", line 1204, in get_application_default
    return GoogleCredentials._get_implicit_credentials()
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/oauth2client/oauth2client/client.py", line 1194, in _get_implicit_credentials
    raise ApplicationDefaultCredentialsError(ADC_HELP_MSG)
oauth2client.client.ApplicationDefaultCredentialsError: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

最佳答案

解决办法是在shell中运行gcloud auth login,重新给grant

关于python - GAE : remote_api and Application Default Credentials,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32567357/

相关文章:

带有内联管道的 Python string.format

google-app-engine - 限制 javax.jdo.Query 中的结果数

python - 从父类继承的子类中删除特定方法

python - diff算法的python实现

python - 改进波检测算法

google-app-engine - 将 Google Cloud KMS 与 Flask、gunicorn 和 gevent worker 一起使用时出错 : "google.api_core.exceptions.ServiceUnavailable: 503 Deadline Exceeded"

python - Google App Engine 上的 IPv6 到 IPv4

java - 对涉及无主关系的实体进行持久更改的问题

node.js - 我如何通过 NodeJs 在谷歌云中设置数据存储索引配置?

google-app-engine - 如何在重新启动之间保留 GoogleAppEngineLauncher 的本地数据存储区?