我首先创建了谷歌云虚拟图像。
我有这样的代码:
>>> from google.cloud import storage
>>> from io import BytesIO
>>> client = storage.Client()
>>> bucket = client.get_bucket('landsst')
但是我得到这样的错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/iashrapov/anaconda3/lib/python3.6/site-packages/google/cloud/storage/client.py", line 177, in get_buc
ket
bucket.reload(client=self)
File "/home/iashrapov/anaconda3/lib/python3.6/site-packages/google/cloud/storage/_helpers.py", line 108, in reloa
d
_target_object=self)
File "/home/iashrapov/anaconda3/lib/python3.6/site-packages/google/cloud/_http.py", line 293, in api_request
raise exceptions.from_http_response(response)
google.api_core.exceptions.Forbidden: 403 GET https://www.googleapis.com/storage/v1/b/lanst?projection=noAcl
: 606507140911-compute@developer.gserviceaccount.com does not have storage.buckets.get access to landsbyconst.
以JSON为输出:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalidParameter",
"message": "Invalid string value: 'noAcl:'. Allowed values: [full, noacl]",
"locationType": "parameter",
"location": "projection"
}
],
"code": 400,
"message": "Invalid string value: 'noAcl:'. Allowed values: [full, noacl]"
}
}
我做错什么了?
ps.通过本地PC运行相同代码返回错误:
DefaultCredentialsError:无法自动确定凭据。请设置Google应用程序凭据或
显式创建凭据并重新运行应用程序。为了更多
信息,请参见
所以最初我没有权限错误或者没有,嗯?
UPD。我可以连接到自己创建的bucket