本文介绍 Python SDK 的注意事项、安装方式和初始化示例。
1. 按下 Win+R ,输入 regedit 打开注册表编辑器。 2. 设置 \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem 路径下的变量 LongPathsEnabled 为 1。
您可以使用 Python SDK 调用 OpenAPI,关于 Python SDK 地址,请参见 Python SDK。
执行以下命令,通过 pip 安装 Python SDK。
pip install volcengine-python-sdk
from __future__ import print_function import volcenginesdkdms import volcenginesdkcore from pprint import pprint from volcenginesdkcore.rest import ApiException if __name__ == '__main__': configuration = volcenginesdkcore.Configuration() configuration.ak = "your ak" configuration.sk = "your sk" configuration.region = "the region your target bucket in" configuration.client_side_validation = True # set default configuration volcenginesdkcore.Configuration.set_default(configuration) # use global default configuration api_instance = volcenginesdkdms.DMSApi() # use custom configuration # api_instance = volcenginesdkecs.ECSApi(volcenginesdkcore.ApiClient(configuration)) try: resp = api_instance.list_data_migrate_task(volcenginesdkdms.ListDataMigrateTaskRequest(offset=0,limit=10)) pprint(resp) except ApiException as e: print("Exception when calling DMSApi->list_data_migrate_task: %s\n" % e)