8
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Google Natural Language API でハマるところ

Posted at

Natural Language APIではまったところをエラーメッセージとともに解決策をメモしておきます。

Cloud Shell上での認証エラー

google.api_core.exceptions.PermissionDenied: 403 Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the language.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.

解決法

サービスアカウントを取得してパスを通す
取得はこちらから
取得したサービスアカウントをセットして環境変数をエクスポート

export GOOGLE_APPLICATION_CREDENTIALS="[PATH]"

ヘルプ詳細

Colabで環境変数を設定できない

DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credential and re-run the application. For more information, please see

Colabはexportされた環境変数を読み込まないためosモジュールを使って設定する。

import os
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'your/path/to/.json'
8
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?