Joe*_*tro 1 google-api google-cloud-storage google-python-api
我正在将 python 客户端库用于 Google Storage API,并且我有一个文件 pythonScript.py,其中包含以下内容:
# Imports the Google Cloud client library
from google.cloud import storage
# Instantiates a client
storage_client = storage.Client()
# The name for the new bucket
bucket_name = 'my-new-bucket'
# Creates the new bucket
bucket = storage_client.create_bucket(bucket_name)
print('Bucket {} created.'.format(bucket.name))
Run Code Online (Sandbox Code Playgroud)
当我尝试运行它时,我在终端中得到了这个:
回溯(最近一次调用):文件“pythonScript.py”,第 11 行,存储桶 = storage_client.create_bucket(bucket_name) 文件“/home/joel/MATI/env/lib/python3.5/site-packages/google/ cloud/storage/client.py”,第 218 行,在 create_bucket bucket.create(client=self) 文件中“/home/joel/MATI/env/lib/python3.5/site-packages/google/cloud/storage/bucket .py”,第 199 行,在 create data=properties, _target_object=self) 文件“/home/joel/MATI/env/lib/python3.5/site-packages/google/cloud/_http.py”,第 293 行,在 api_request 中引发 exceptions.from_http_response(response) google.cloud.exceptions.Conflict: 409 POST https://www.googleapis.com/storage/v1/b?project=avid-folder-180918:抱歉,该名称不可用. 请尝试不同的。
我不知道为什么,因为我确实为我的项目启用了 GSS API,而且默认配置似乎是正确的。的输出gcloud config list是:
[计算]
地区 = us-east1
区域 = us-east1-d
[核心] 帐户 = joel@southbendcodeschool.com
disable_usage_reporting = True
项目 = avid-folder-180918
您的活动配置是:[默认]
| 归档时间: |
|
| 查看次数: |
1255 次 |
| 最近记录: |