Python SDK
更新时间:
快速安装
通过pip安装
pip install oassdk
快速开发
使用 Python SDK 的高级接口可实现快速的功能开发,以下展示几个常用的操作
创建Vault
from oas.oas_api import OASAPI
from oas.ease.vault import Vault
# 创建OASAPI对象
api = OASAPI('[Server Host]', '[Access Key ID]', '[Access Key Secret]')
# 创建Vault
vault = Vault.create_vault(api, '[Vault Name]')
查找Vault
# 创建OASAPI对象
api = OASAPI('[Server Host]', '[Access Key ID]', '[Access Key Secret]')
# 根据名称获取Vault
vault = Vault.get_vault_by_name(api, '[Vault Name]')
# 根据ID获取Vault
vault = Vault.get_vault_by_id(api, '[Vault ID]')
上传文件
archive_id = vault.upload_archive('[File Path]')
删除Archive
vault.delete_archive('[Archive ID]')
续传Multipart Upload任务
uploader = vault.recover_uploader('[Upload ID]')
uploader.resume('[File Path]')
获取Archive列表
job = vault.retrieve_inventory()
job.download_to_file('[File Path]')
下载Archive
job = vault.retrieve_archive('[Archive ID]')
job.download_to_file('[File Path]')
文档内容是否对您有帮助?