[英]Jupyter Notebook: Access Google Cloud API
I am running my Jupyter notebooks locally via Docker ( jupyter/scipy-notebook )我正在通过 Docker ( jupyter/scipy-notebook ) 在本地运行我的 Jupyter 笔记本
So far I always accessed APIs by saving the credentials in the.env file where the Dockerfile lives.到目前为止,我总是通过将凭据保存在 Dockerfile 所在的 .env 文件中来访问 API。 However, now I start working with Google Cloud and the private keys are "handed over" to me in a private key JSON file .
但是,现在我开始使用 Google Cloud,并且私钥在私钥 JSON 文件中“移交”给我。 I now wonder how that works together with the.env I am currently using.
我现在想知道它如何与我目前使用的 .env 一起工作。 Can I just insert the path to the file in my.env file?
我可以在 my.env 文件中插入文件的路径吗? Probably not... but I currently have no better idea.
可能不会……但我目前没有更好的主意。
As far as I remember, you will have to create an environment variable called GOOGLE_APPLICATION_CREDENTIALS
and the value is the path to that JSON file key you've got.据我记得,您必须创建一个名为
GOOGLE_APPLICATION_CREDENTIALS
的环境变量,其值是您拥有的 JSON 文件密钥的路径。
The GOOGLE_APPLICATION_CREDENTIALS
is the default name Google libraries will look for in determining the path to the key. GOOGLE_APPLICATION_CREDENTIALS
是 Google 库在确定密钥路径时将查找的默认名称。 This is done when you create an instance of the specific client library.这在您创建特定客户端库的实例时完成。
Here's a link.这是一个链接。 Section Setting the environment variable talks about it.
设置环境变量一节谈到了它。 https://cloud.google.com/docs/authentication/getting-started
https://cloud.google.com/docs/authentication/getting-started
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.