Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 916 Bytes

get_bucket_notification.md

File metadata and controls

33 lines (25 loc) · 916 Bytes

GET Bucket Notification

Code Snippet

Initialize the Qingstor object with your AccessKeyID and SecretAccessKey.

from qingstor.sdk.service.qingstor import QingStor
from qingstor.sdk.config import Config

config = Config('ACCESS_KEY_ID_EXAMPLE', 'SECRET_ACCESS_KEY_EXAMPLE')
qingstor = QingStor(config)

Initialize a Bucket object according to the bucket name you set for subsequent creation:

bucket_name = "your-bucket-name"
zone_name = "pek3b"
bucket_srv = qingstor.Bucket(bucket_name, zone_name)

After created the object, we need perform the action to GET Bucket Notification:

resp = bucket_srv.get_notification()
if resp.status_code != 200:
    print("Get notifications of bucket(name: %s) failed with given message: %s\n" % (
        bucket_name, str(resp.content, 'utf-8')))
else:
    print("The bucket notifications info:")
    print(resp['notifications'])