Google Cloud Shell is using project=cloud-devshell

2019-02-24 03:54发布

I created a GCP project to play around with the video-intelligence API. I enabled the API on my project and launched a Cloud Shell.

I then copied the code from github and followed the README instructions.

However, when I try to run faces.py I get this error message:

StatusCode.PERMISSION_DENIED, Google Cloud Video Intelligence API has not been used in project cloud-devshell-dev before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/videointelligence.googleapis.com/overview?project=cloud-devshell-dev then retry

Why is it pointing to project=cloud-devshell-dev and not to my videointel project?

If I gcloud config list I can see the correct project and service account. Baffled.

1条回答
戒情不戒烟
2楼-- · 2019-02-24 04:17

Create a service account and have your application use it for API access, run:

  $ gcloud iam service-accounts create my-account
  $ gcloud iam service-accounts keys create key.json
    --iam-account=my-account@my-project.iam.gserviceaccount.com
  $ export GOOGLE_APPLICATION_CREDENTIALS=key.json

In the second command replace my-project with your Project ID.

查看更多
登录 后发表回答