• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. Developer Guide (Python SDK)
  4. Event Notification
  5. Viewing Event Notification Settings

Viewing Event Notification Settings

You can call ObsClient.getBucketNotification to view event notification settings of a bucket. Sample code is as follows:

# Import the module.
from com.obs.client.obs_client import ObsClient
 
# Create an instance of ObsClient.
obsClient = ObsClient(
    access_key_id='*** Provide your Access Key ***',    
    secret_access_key='*** Provide your Secret Key ***',    
    server='yourdomainname'
)
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)