cry*_*bhu 1 google-cloud-platform
我正在使用Python 客户端库运行一些脚本来在 GCP 中执行一些临时作业。
这些是临时的,因此我相信它们应该在我的最终用户凭据而不是服务帐户上运行。
我不断看到此警告,这使得调试我的脚本标准输出变得困难:
UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a "quota exceeded" or "API not enabled" error. We recommend you rerun `gcloud auth application-default login` and make sure a quota project is added. Or you can use service accounts instead. For more information about service accounts, see https://cloud.google.com/docs/authentication/
Run Code Online (Sandbox Code Playgroud)
我执行了建议的操作gcloud auth application-default login,但仍然重复出现相同的警告消息。
如何禁用此警告?
看看图书馆里的台词。该消息被硬编码到名为的函数中_warn_about_problematic_credentials(从第 59 行开始)。
如果深入查看该文件,您会发现仅当未定义配额项目时才会显示警告消息。
您可以使用以下命令将配额项目添加到您的应用程序默认凭据中:
gcloud auth application-default set-quota-project <YOUR PROJECT ID>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5476 次 |
| 最近记录: |