I'm using the api sample as found here.
Running gcloud config list
shows my default project as project = multichoice-insights
Important extract of the code shows that I get the default credentials:
credentials = GoogleCredentials.get_application_default().create_scoped(
['https://www.googleapis.com/auth/cloud-platform'],
)
However, when I try and use the api, I get the error message:
googleapiclient.errors.HttpError: <HttpError 403 when requesting
https://language.googleapis.com/v1beta1/documents:analyzeSentiment?
alt=json returned "Google Cloud Natural Language API has not been used
in project google.com:cloudsdktool before or it is disabled. Enable it
by visiting
https://console.developers.google.com/apis/api/language.googleapis.com/over
view?project=google.com:cloudsdktool then retry. If you enabled this
API recently, wait a few minutes for the action to propagate to our
systems and retry.">
I think this shows that the project used: project=google.com:cloudsdktool
How can I change this to project-name
?
I have enabled this api in the console.