den*_*r81 2 python google-app-engine google-api google-oauth google-api-python-client
我正在尝试从我的 Python 脚本访问 BigQuery API。目前我正在试验只是想让这个示例运行。
我创建了凭据,设置了环境变量并运行了脚本,却收到此错误:
oauth2client.client.ApplicationDefaultCredentialsError: An error was encountered while reading json file: /PATH/TO/MY/google_api_credentials.json (pointed to by GOOGLE_APPLICATION_CREDENTIALS environment variable): 'type' field should be defined (and have one of the 'authorized_user' or 'service_account' values)
Run Code Online (Sandbox Code Playgroud)
嗯,它没有在 JSON 文件中设置:
{"installed":{"client_id":"blahblah.apps.googleusercontent.com","project_id":"blahblah","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://accounts.google.com/o/oauth2/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"blahblah","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}
Run Code Online (Sandbox Code Playgroud)
既然我从 Google 控制台下载了 JSON,它应该就可以工作吗?我不知道我需要定义什么“类型”。
归档时间: |
|
查看次数: |
3290 次 |
最近记录: |