def does_bucket_exist(self, bucket_name, config=None):
"""
Check whether there is a bucket with specific name
:param bucket_name: None
:type bucket_name: str
:return:True or False
:rtype: bool
"""
try:
self._send_request(http_methods.HEAD, bucket_name, config=config)
return True
except BceHttpClientError as e:
if isinstance(e.last_error, BceServerError):
if e.last_error.status_code == httplib.FORBIDDEN:
return True
if e.last_error.status_code == httplib.NOT_FOUND:
return False
raise e
评论列表
文章目录