Fay*_*med 2 google-cloud-storage google-cloud-platform
我正在尝试以下代码来访问Google云端存储:
client = storage.Client(credentials = GoogleCredentials.from_stream(<path-to-service-account-json>))
Run Code Online (Sandbox Code Playgroud)
抛出此错误:
ValueError: This library only supports credentials from google-auth-library-python. See https://google-cloud-python.readthedocs.io/en/latest/google-cloud-auth.html for help on authentication with this library.
Run Code Online (Sandbox Code Playgroud)
我能够discovery.build使用相同的凭据(使用获得GoogleCredentials.from_stream())来验证服务,但由于某种原因,storage.Client无法使用提供的凭据.
如果我遗失了什么,请告诉我.
Fay*_*med 12
得到它使用以下代码:
storage_client = storage.Client.from_service_account_json(<path-to-service-account-json>)
Run Code Online (Sandbox Code Playgroud)
不确定为什么有不同的方法来验证发现API以及存储和其他客户端API.
| 归档时间: |
|
| 查看次数: |
3550 次 |
| 最近记录: |