Obtaining a Bucket Policy
API Description
You can use this API to obtain the configuration information of a bucket policy.
Method Definition
ObsClient.getBucketPolicy(bucketName)
Request Parameters
| Field | Type | Optional or Mandatory | Description |
|---|---|---|---|
| bucketName | str | Mandatory | Bucket name |
Returned Results
| Type | Description |
|---|---|
| SDK common result object |
| GetResult.body Type | Description |
|---|---|
| Bucket policy |
Sample Code
try:
resp = obsClient.getBucketPolicy('bucketname')
if resp.status < 300:
print('requestId:', resp.requestId)
print('policyJSON:' , resp.body.policyJSON)
else:
print('errorCode:', resp.errorCode)
print('errorMessage:', resp.errorMessage)
except:
import traceback
print(traceback.format_exc()) Last Article: Configuring a Bucket Policy
Next Article: Deleting a Bucket Policy
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.