文档中心 > 获取桶的访问权限
获取桶的访问权限

最近更新时间:2021-09-22

以下代码用于获取桶的访问权限:

from src.ossConfig import ossConfig

import unicloud_oss.Oss as Oss

access_key = 'XXXXXXXXX'
secret_key = 'XXXXXXXXXXXXXXXXXXX'
endpoint_url = 'http://XXXXXXXXXXXXXXXXX.com'
config = ossConfig(access_key,secret_key,endpoint_url)

bucket_name = 'test1'

bucket_acl = Oss.get_bucket_acl(config, bucket_name)
if bucket_acl is None:
   print('Error!')
else:
   print(f'   {bucket_acl["Grants"]}')