Python 阿里云OSS上传图片指定Cache-Control

462次阅读
没有评论

python 代码示例如下

import oss2
................. 省略代码            

for param in (access_key_id, access_key_secret, bucket_name, endpoint):
                assert '<' not in param, '请设置参数:' + param
            bucket = oss2.Bucket(oss2.Auth(access_key_id, access_key_secret), endpoint, bucket_name)
            with open(oss2.to_unicode(src_name), 'rb') as f:
                bucket.put_object(det_name, f,headers={"Cache-Control":"max-age=2592000"})

bucket.put_object(det_name, f,headers={“Cache-Control”:”max-age=2592000″})

正文完
 
ddn
版权声明:本站原创文章,由 ddn 2023-09-13发表,共计415字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。