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‘)
原文地址:https://www.cnblogs.com/blog-rui/p/11029445.html
时间: 2024-09-30 18:17:33