阿里云对象存储调用例子
Posted blog-rui
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了阿里云对象存储调用例子相关的知识,希望对你有一定的参考价值。
import oss2 ACCESS_KEY_ID = ‘LTAIF85FxvOeg3o8‘ ACCESS_KEY_SECRET = ‘8cLbVNSv0l4W5kpMkdJZoL5hUqyLKm‘ BUCKET_NAME = "pyserver" HOST_NAME = ‘oss-cn-hangzhou.aliyuncs.com‘ def upload(file_name, file_path): bucket = oss2.Bucket(oss2.Auth(ACCESS_KEY_ID, ACCESS_KEY_SECRET), HOST_NAME, BUCKET_NAME) res = bucket.put_object_from_file(file_name, file_path) print(res.resp.response.url) if __name__ == "__main__": upload("dxrj1.0.2.zip", ‘./dxrj1.0.2.zip‘)
以上是关于阿里云对象存储调用例子的主要内容,如果未能解决你的问题,请参考以下文章