1111
1212* Python版本需要不低于2.7。
1313* 由于 Windows 系统有最长路径限制,可能会导致安装失败,请按照以下方式设置:
14+
1415```
15161. 按下 Win+R ,输入 regedit 打开注册表编辑器。
16172. 设置 \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem 路径下的变量 LongPathsEnabled 为 1 即可。
1920### Install ###
2021
2122Install via pip
23+
2224``` sh
2325pip install volcengine-python-sdk
2426```
@@ -31,7 +33,54 @@ python setup.py install --user
3133
3234(or ` sudo python setup.py install ` to install the package for all users)
3335
34- ### Basic Usage ###
36+ ### Configuration Usage ###
37+
38+ 步骤一:启动时初始化,配置 Configuration 全局默认参数
39+
40+ ``` python
41+ configuration = volcenginesdkcore.Configuration()
42+ configuration.client_side_validation = True # 客户端是否进行参数校验
43+ configuration.schema = " http" # https or http
44+ configuration.debug = False # 是否开启调试
45+ configuration.logger_file = " sdk.log"
46+
47+ volcenginesdkcore.Configuration.set_default(configuration)
48+ ```
49+
50+ 步骤二:获取 Client
51+
52+ ``` python
53+ def get_client (ak , sk , region ):
54+ # 包含默认属性
55+ configuration = volcenginesdkcore.Configuration()
56+ configuration.ak = ak
57+ configuration.sk = sk
58+ configuration.region = region
59+ client = volcenginesdkautoscaling.AUTOSCALINGApi(volcenginesdkcore.ApiClient(configuration))
60+ return client
61+ ```
62+
63+ ### Endpoint 设置 ###
64+
65+ 如果您要自定义SDK的Endpoint,可以按照以下示例代码设置:
66+
67+ ``` python
68+ configuration = volcenginesdkcore.Configuration()
69+ configuration.host = ' ecs.cn-beijing-autodriving.volcengineapi.com'
70+ ```
71+
72+ 火山引擎标准的Endpoint规则说明:
73+
74+ | Regional 服务 | Global 服务 |
75+ | ----------------------------------------------------------------------------------------------------------------------------------------| ------------------------------------------------------------------------------------|
76+ | ` {service}.{region}.volcengineapi.com ` <br > 例如:云服务ecs在cn-beijing-autodriving Region域名为: ` ecs.cn-beijing-autodriving.volcengineapi.com ` | ` {service}.volcengineapi.com ` <br > 例如:访问控制iam为Global服务,域名为:` iam.volcengineapi.com ` |
77+
78+ 注:
79+
80+ - Service中存在_符号时,Endpoint时需转为-符号。存在大写字母时需转成小写。
81+ - 并非所有云产品和Region都支持标准域名,具体请前往您所使用的产品-API参考中查看。
82+
83+ ### SDK 示例 ###
3584
3685``` python
3786from __future__ import print_function
@@ -77,27 +126,7 @@ if __name__ == '__main__':
77126 print (" Exception when calling ECSApi->run_instances: %s \n " % e)
78127
79128```
80- ### Configuration Usage ###
81- 步骤一:启动时初始化,配置 Configuration 全局默认参数
82- ``` python
83- configuration = volcenginesdkcore.Configuration()
84- configuration.client_side_validation = True # 客户端是否进行参数校验
85- configuration.schema = " http" # https or http
86- configuration.debug = False # 是否开启调试
87- configuration.logger_file = " sdk.log"
88129
89- volcenginesdkcore.Configuration.set_default(configuration)
90- ```
91- 步骤二:获取 Client
92- ``` python
93- def get_client (ak , sk , region ):
94- # 包含默认属性
95- configuration = volcenginesdkcore.Configuration()
96- configuration.ak = ak
97- configuration.sk = sk
98- configuration.region = region
99- client = volcenginesdkautoscaling.AUTOSCALINGApi(volcenginesdkcore.ApiClient(configuration))
100- return client
101- ```
102130### FAQ ###
131+
103132关于 SDK 使用时碰到的常见问题,请查看 [ FAQ] ( FAQ.md )
0 commit comments