Deleting a Bucket Policy

API Description

You can use this API to delete a bucket policy. Calling this API will delete all bucket policies, instead of one single policy. To delete a single policy, see the API for configuring a bucket policy.

Method Definition

ObsClient.deleteBucketPolicy(bucketName)

Request Parameters

Field

Type

Optional or Mandatory

Description

bucketName

str

Mandatory

Bucket name

Returned Results

Type

Description

GetResult

SDK common result object

Sample Code

try:
    resp = obsClient.deleteBucketPolicy('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())