文档中心 > 下载到本地文件
下载到本地文件

最近更新时间:2022-07-25

本文档介绍如何将UOS文件下载到本地。

以下代码用于把指定的UOS文件下载到本地文件:

from src.ossConfig import ossConfig

import unicloud_oss.Oss as Oss

access_key = 'youraccesskey'
secret_key = 'yoursecretkey'
endpoint_url = 'http://oss-cn-north-2.unicloudsrv.com'
config = ossConfig(access_key,secret_key,endpoint_url)

bucket_name = 'test1'
object_name = 'mytestput1'
filename = 'D:\\test\\aaa.py'

if Oss.download_object(config, bucket_name, object_name, filename):
   print("download object sucess!")
else:
   print("download object failed!")