Google Cloud Vision API: "There are not enough authentication areas in the request."

Hi, I'm trying to use the Google Cloud Widget API, in particular this example: https://cloud.google.com/vision/docs/label-tutorial#label_tutorial_1

I completed this lesson: https://cloud.google.com/vision/docs/getting-started#set_up_a_service_account to set up a service account, but when I run my code, I get:

googleapiclient.errors.HttpError: <HttpError 403 when requesting https://vision.googleapis.com/$discovery/rest?version=v1 returned "Request had insufficient authentication scopes.">

Can anyone help? I can not understand what is happening, my code is 1: 1 with textbooks.

+4
source share
3 answers

~/.credentials/sheets.googleapis.com-python-quickstart.json . https://www.googleapis.com/auth/drive. , . .

+5

. :

sudo apt-get update & apt-get upgrade

pip install --upgrade google-api-python-client

gcloud sdk ...

gcloud init 

!

API

+3

google.cloud API Vision.

, Cloud Console ( ). . "" :

Cloud Console. JSON :

$ export GOOGLE_CLOUD_PROJECT="your-project-id-here"
$ export GOOGLE_APPLICATION_CREDENTIALS="/path/to/keyfile.json"

, ( ), :

>>> from google.cloud import vision
>>> client = vision.Client()
>>> image = client.image(source_uri='gs://my-storage-bucket/image.jpg')
>>> labels = image.detect_labels(limit=3)
>>> labels[0].description
'automobile'
>>> labels[0].score
0.9863683

( , docs)

0

All Articles