You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error while using this script from Google Cloud API #683
Traceback (most recent call last):
File "analyze.py", line 103, in
result = analyze_entities(args.text, get_native_encoding_type())
File "analyze.py", line 53, in analyze_entities
response = request.execute()
File "/home/florinb/python-docs-samples/language/env/local/lib/python2.7/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "/home/florinb/python-docs-samples/language/env/local/lib/python2.7/site-packages/googleapiclient/http.py", line 838, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://language.googleapis.com/v1/documents:analyzeEntities?alt=json returned "Request had insufficient authentication scopes.">
Thanks for the bug report. Are you running the latest version of the code? I can't be sure because you didn't provide the full path to the analyze.py that you ran, but from the looks of your stack trace, since you're running from a virtualenv in the language/ directory, I'm guessing you're running the file language/analyze.py. Note that the latest version of analyze.py is in the directory language/api/.
Try pulling down the latest version of the code:
cd ~/python-docs-samples/
git pull origin
and running it again:
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/credentials.json
cd language/api/
python analyze.py -h
python analyze.py syntax "John is late"
@baditaflorin - I see that you are getting HTTP 403 error codes. You need to Enable the speech API in your Cloud API Project and set the GOOGLE_APPLICATION_CREDENTIAL environment variable to the service account credentials that you downloaded when you set up the project.
Activity
theacodes commentedon Nov 28, 2016
@puneith or @jerjou any ideas?
jerjou commentedon Nov 28, 2016
Hello!
Thanks for the bug report. Are you running the latest version of the code? I can't be sure because you didn't provide the full path to the
analyze.pythat you ran, but from the looks of your stack trace, since you're running from a virtualenv in thelanguage/directory, I'm guessing you're running the filelanguage/analyze.py. Note that the latest version ofanalyze.pyis in the directorylanguage/api/.Try pulling down the latest version of the code:
and running it again:
puneith commentedon Feb 11, 2017
@baditaflorin Did it work for you?
gguuss commentedon Feb 14, 2017
@baditaflorin - I see that you are getting HTTP 403 error codes. You need to Enable the speech API in your Cloud API Project and set the GOOGLE_APPLICATION_CREDENTIAL environment variable to the service account credentials that you downloaded when you set up the project.
jerjou commentedon Feb 28, 2017
Closing due to inactivity. Please comment with an update if you're still getting this error, and we can reopen.