• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (Python SDK)
  4. Bucket-Related APIs
  5. GET Bucket notification

GET Bucket notification

API Description

You can use this API to obtain the event notification configuration of a bucket.

Method Definition

ObsClient.getBucketNotification(bucketName)

Request Parameter

Field

Type

Optional or Mandatory

Description

bucketName

str

Mandatory

Bucket name

Returned Result

Type

Description

GetResult

SDK common result object

GetResult.body Type

Description

Notification

Bucket event notification settings

Sample Code

try:
    resp = obsClient.getBucketNotification('bucketname') 
      
    if resp.status < 300: 
        print('requestId:', resp.requestId) 
        for topicConfiguration in resp.body.topicConfigurations:
            print('id:', topicConfiguration.id)
            print('topic:', topicConfiguration.topic)
            print('events:', topicConfiguration.events)
            index = 1
            for rule in topicConfiguration.filterRules:
                print('rule [' + str(index) + ']')
                print('name:', rule.name)
                print('value:', rule.value)
    else: 
        print('errorCode:', resp.errorCode) 
        print('errorMessage:', resp.errorMessage)
except:
    import traceback
    print(traceback.format_exc())