Obtaining the Tag Settings of a Bucket
API Description
You can use this API to obtain the tag settings of a specified bucket.
Method Definition
ObsClient.getBucketTagging(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 tag set |
Sample Code
try:
resp = obsClient.getBucketTagging('bucketname')
if resp.status < 300:
print('requestId:', resp.requestId)
index = 1
for tag in resp.body.tagSet:
print('tag [' + str(index) + ']')
print('key:', tag.key)
print('value:', tag.value)
index +=1
else:
print('errorCode:', resp.errorCode)
print('errorMessage:', resp.errorMessage)
except:
import traceback
print(traceback.format_exc()) Last Article: Adding Tags to a Bucket
Next Article: Deleting Tags of a Bucket
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.