本文介绍如何设置和读取文件访问权限。
创建一个对象并设置对象权限为公共读/公共读写,并读取这个对象的权限代码如下:
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' object_name = 'mytestput' response = Oss.get_object_acl(config, bucket_name,object_name) print(response) ACL = 'public-read' if Oss.put_object_acl(config,bucket_name,object_name,ACL): print("put object acl sucess!") else: print("put object acl fail!") |