Google Cloud Client, reported google.api_core.exceptions.Forbidden: 403 error

from the Google Cloud Client Libraries official document: python/latest/translate/usage.html" rel=" nofollow noreferrer "> https://googlecloudplatform.g.

from google.cloud import translate
client = translate.Client()
client.translate(["Me llamo Jeff", "My name is Jeff"],target_language="de")

Code execution result:

C:\Python27\lib\site-packages\google\auth\_default.py:66: UserWarning: Your application has authenticated using end user
 credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your app
lication continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled"
 error. For more information about service accounts, see https://cloud.google.com/docs/authentication/.
  warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
Traceback (most recent call last):
  File "C:\Code\Google\test\run.py", line 15, in <module>
    target_language=target)
  File "C:\Python27\lib\site-packages\google\cloud\translate_v2\client.py", line 233, in translate
    method="POST", path="", data=data)
  File "C:\Python27\lib\site-packages\google\cloud\_http.py", line 293, in api_request
    raise exceptions.from_http_response(response)
google.api_core.exceptions.Forbidden: 403 POST https://translation.googleapis.com/language/translate/v2: Your applicatio
n has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported b
y the translate.googleapis.com. We recommend that most server applications use service accounts instead. For more inform
ation about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.

but if executed under cmd, you can execute

normally.
>>> from google.cloud import translate
>>> client = translate.Client()
>>> client.translate(["Me llamo Jeff", "My name is Jeff"],target_language="de")
[{u"translatedText": u"Mein Name ist Jeff", "input": "Me llamo Jeff", u"detected
SourceLanguage": u"es"}, {u"translatedText": u"Mein Name ist Jeff", "input": "My
 name is Jeff", u"detectedSourceLanguage": u"en"}]
Jul.09,2021
Menu