IBM COS - 无法使用 boto 获取或创建存储桶
IBM COS - can't get or create bucket with boto
from boto.s3.connection import S3Connection
conn = S3Connection('****', '****', host='s3.eu-geo.objectstorage.softlayer.net')
mybucket = conn.get_bucket('mybucket')
Returns
/anaconda3/lib/python3.6/site-packages/boto/s3/connection.py in head_bucket(self, bucket_name, headers)
551 err.error_code = 'NoSuchBucket'
552 err.error_message = 'The specified bucket does not exist'
--> 553 raise err
554 else:
555 raise self.provider.storage_response_error(
S3ResponseError: S3ResponseError: 404 Not Found
但是,如果我尝试创建存储桶:
conn.create_bucket('mybucket')
S3CreateError: S3CreateError: 409 Conflict
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Error><Code>BucketAlreadyExists</Code><Message>Container mybucket exists</Message><Resource>/mybucket/</Resource><RequestId>****</RequestId><httpStatusCode>409</httpStatusCode></Error>
存储桶名称在 IBM Cloud 对象存储(或 AWS S3)中是普遍唯一的。存储桶的删除最终是一致的,传播需要 10 分钟,这意味着最近删除的存储桶(由您或任何其他用户)的存储桶名称将需要一些时间才能再次可用。你说的这个错误说明这个bucket 'mybucket' 最近被删除了,并且在这个名字不可用的时期。通常建议在存储桶名称之前使用一些特定的前缀,如果它是常见的(如 mybucket)。查看 IBM COS API docs 中的这段摘录:
A DELETE issued to an empty bucket deletes the bucket. After deleting a bucket the name will be held in reserve by the system for 10 minutes, after which it will be released for re-use. Only empty buckets can be deleted. This operation does not make use of operation specific headers, query parameters, or payload elements.
from boto.s3.connection import S3Connection
conn = S3Connection('****', '****', host='s3.eu-geo.objectstorage.softlayer.net')
mybucket = conn.get_bucket('mybucket')
Returns
/anaconda3/lib/python3.6/site-packages/boto/s3/connection.py in head_bucket(self, bucket_name, headers)
551 err.error_code = 'NoSuchBucket'
552 err.error_message = 'The specified bucket does not exist'
--> 553 raise err
554 else:
555 raise self.provider.storage_response_error(
S3ResponseError: S3ResponseError: 404 Not Found
但是,如果我尝试创建存储桶:
conn.create_bucket('mybucket')
S3CreateError: S3CreateError: 409 Conflict
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Error><Code>BucketAlreadyExists</Code><Message>Container mybucket exists</Message><Resource>/mybucket/</Resource><RequestId>****</RequestId><httpStatusCode>409</httpStatusCode></Error>
存储桶名称在 IBM Cloud 对象存储(或 AWS S3)中是普遍唯一的。存储桶的删除最终是一致的,传播需要 10 分钟,这意味着最近删除的存储桶(由您或任何其他用户)的存储桶名称将需要一些时间才能再次可用。你说的这个错误说明这个bucket 'mybucket' 最近被删除了,并且在这个名字不可用的时期。通常建议在存储桶名称之前使用一些特定的前缀,如果它是常见的(如 mybucket)。查看 IBM COS API docs 中的这段摘录:
A DELETE issued to an empty bucket deletes the bucket. After deleting a bucket the name will be held in reserve by the system for 10 minutes, after which it will be released for re-use. Only empty buckets can be deleted. This operation does not make use of operation specific headers, query parameters, or payload elements.