我正在使用此处找到的 api 示例。
运行gcloud config list
显示我的默认项目为project = multichoice-insights
代码的重要摘录显示我获得了默认凭据:
credentials = GoogleCredentials.get_application_default().create_scoped(
['https://www.googleapis.com/auth/cloud-platform'],
)
但是,当我尝试使用 api 时,我收到错误消息:
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.">
我认为这表明该项目使用了:project=google.com:cloudsdktool
我怎样才能将其更改为project-name
?
我已经在控制台中启用了这个 api。