Deleting a Bucket
API Description
You can use this API to delete a bucket. The bucket to be deleted must be empty (containing no objects, noncurrent object versions, or part fragments). Bucket deletion is a non-idempotence operation and will fail if the to-be-deleted bucket does not exist.
Method Definition
ObsClient.deleteBucket(bucketName)
Request Parameters
| Field | Type | Optional or Mandatory | Description |
|---|---|---|---|
| bucketName | str | Mandatory | Bucket name |
Returned Results
| Type | Description |
|---|---|
| SDK common result object |
Sample Code
try:
resp = obsClient.deleteBucket('bucketname')
if resp.status < 300:
print('requestId:', resp.requestId)
else:
print('errorCode:', resp.errorCode)
print('errorMessage:', resp.errorMessage)
except:
import traceback
print(traceback.format_exc()) Last Article: Checking Whether a Bucket Exists
Next Article: Listing Objects in a Bucket
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.