Skip to content

Commit a3e84a6

Browse files
committed
Merge "integration_2026-01-22_1106749899266" into "cloudmonitor-Python-2018-01-01-online-1907-2025_12_03_14_17_08"
Conflicts: pyproject.toml
2 parents f7c7a44 + 4b45d2c commit a3e84a6

1,694 files changed

Lines changed: 296371 additions & 3153 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

FAQ.EN.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
### 1. Get Request and Response Types
2+
3+
Before calling a method, you can obtain the corresponding request and response structures via `param` and `return`.
4+
Taking `ecs.run_instances` as an example:
5+
6+
```python
7+
def run_instances(self, body, **kwargs): # noqa: E501
8+
"""run_instances
9+
:param RunInstancesRequest body: (required)
10+
:return: RunInstancesResponse
11+
"""
12+
```
13+
14+
### 2. Get Parameter Types for Requests and Responses
15+
16+
In the Request or Response body, you can check specific request parameters and their types via `swagger_types`.
17+
Taking `volcenginesdkecs.RunInstancesRequest` as an example, its parameter names and definitions are as follows:
18+
19+
```python
20+
swagger_types = {
21+
'auto_renew': 'bool',
22+
'auto_renew_period': 'int',
23+
'client_token': 'str',
24+
'count': 'int',
25+
'network_interfaces': 'list[NetworkInterfaceForRunInstancesInput]',
26+
'security_enhancement_strategy': 'str',
27+
'volumes': 'list[VolumeForRunInstancesInput]',
28+
......
29+
}
30+
```
31+
32+
The corresponding request body is:
33+
34+
```python
35+
volcenginesdkecs.RunInstancesRequest(
36+
instance_name="insname",
37+
network_interfaces=[volcenginesdkecs.NetworkInterfaceForRunInstancesInput(
38+
subnet_id="subnet-2d68bh73d858ozfekrm8fj",
39+
security_group_ids=["sg-2b3dq7v0ha0w2dx0eg0nhljv"],
40+
)],
41+
image_id="image-ybvz29l3da4ox5h0m9",
42+
volumes=[volcenginesdkecs.VolumeForRunInstancesInput(
43+
volume_type="ESSD",
44+
size=40,
45+
)],
46+
key_pair_name="vtable",
47+
instance_charge_type="PostPaid"
48+
)
49+
```
50+
51+
### 3. Memory Overflow Occurs
52+
53+
Check whether `Configuration._default` has been initialized.
54+
If not, each time you create a `Configuration` instance, a new logger handler will be created and added to the global logger.
55+
It is recommended to set the default configuration via `Configuration.set_default`.
56+
57+
```python
58+
configuration = volcenginesdkcore.Configuration()
59+
configuration.client_side_validation = False
60+
configuration.schema = "http" # https or http
61+
configuration.debug = False # Whether to enable debugging
62+
63+
volcenginesdkcore.Configuration.set_default(configuration)
64+
```
65+
66+
### 4. Convert Object to Dict
67+
68+
For request and response objects, you can convert them to `dict` using the `to_dict()` method.
69+
70+
### 5. View Usage Examples
71+
72+
[volcenginesdkexamples](https://github.com/volcengine/volcengine-python-sdk/tree/master/volcenginesdkexamples)
73+
74+
### 6. Convert Response Object to CamelCase Dict
75+
76+
After calling an API, the parameters in the received response object typically use PascalCase (CamelCase with the first letter capitalized). When coding with the Python SDK, since Python generally uses snake_case, you may want to convert between the SDK's snake_case fields and the documentation's CamelCase fields.
77+
78+
You can convert the response object into a CamelCase dictionary with the following code. After conversion, the field names in the dictionary will be exactly the same as those in the documentation.
79+
80+
```python
81+
import json
82+
import pprint
83+
from volcenginesdkcore.model import canonical_str
84+
85+
try:
86+
resp = api_instance.list_users(req)
87+
pprint(resp) # Response object with snake_case fields
88+
dict_resp = json.loads(json.dumps(canonical_str(resp)))
89+
pprint(dict_resp) # Response dict with CamelCase fields
90+
91+
except ApiException as e:
92+
print("Exception when calling IAMApi->ListUsers: %s\n" % e)
93+
94+
```
95+
96+
However, this is not the recommended approach. It is suggested to directly use the snake_case parameters in the response object instead of converting.

README.EN.MD

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
English | [中文](README.md)
2+
3+
# Volcengine SDK for Python
4+
## ⚠️ Known Issue (Historical Versions)
5+
6+
In some historical versions of **volcengine-python-sdk** (**4.0.1 – 4.0.42**, inclusive), the SDK’s built-in retry mechanism has a defect.
7+
8+
When a request encounters an exception (such as network instability or API errors), the SDK may trigger its retry logic internally; however, due to this defect, the retry does not take effect as expected. As a result, the client may still experience the exception from the initial request, and the retry mechanism cannot effectively improve request success rates.
9+
10+
### Affected Versions
11+
12+
- **SDK**: volcengine-python-sdk
13+
- **Versions**: 4.0.1 – 4.0.42 (inclusive)
14+
15+
### Impact
16+
17+
For applications that rely on the SDK’s retry mechanism to handle transient failures or network instability:
18+
19+
- Actual request availability may be lower than expected
20+
- Retry configurations may not function as intended
21+
22+
### Resolution and Recommendation
23+
24+
This issue has been fixed in **version 4.0.43 and above**.
25+
**We strongly recommend all users upgrade to volcengine-python-sdk ≥ 4.0.43** to ensure the retry mechanism functions correctly in exception scenarios.
26+
27+
## Breaking Change Notice
28+
29+
Breaking change notice for Volcengine SDK for Python.
30+
31+
Affected versions: `3.0.1` and later
32+
33+
Change description:
34+
35+
To address installation failures on Windows caused by excessively long package paths, starting from `3.0.1` we shortened some overly long API model filenames under the `transitrouter` service. If you depended on those full model filenames, this change is not backward compatible. Use the shortened model name as follows:
36+
37+
```python
38+
from volcenginesdktransitrouter import TransitRouterBandwidthPackageForDescribeTransitRouterBandwidthPackagesOutput
39+
40+
var = TransitRouterBandwidthPackageForDescribeTransitRouterBandwidthPackagesOutput()
41+
```
42+
43+
Impacted service and APIs:
44+
45+
Service: `transitrouter`
46+
47+
Version: `2020-04-01`
48+
49+
APIs:
50+
51+
- DescribeTransitRouterBandwidthPackages
52+
- DescribeTransitRouterRoutePolicyTables
53+
- DescribeTransitRouterRoutePolicyEntries
54+
- DescribeTransitRouterForwardPolicyTables
55+
- DescribeTransitRouterBandwidthPackagesBilling
56+
- DescribeTransitRouterDirectConnectGatewayAttachments
57+
- DescribeTransitRouterRouteTableAssociations
58+
- DescribeTransitRouterRouteTablePropagations
59+
- DescribeTransitRouterTrafficQosQueueEntries
60+
- DescribeTransitRouterTrafficQosQueuePolicies
61+
- DescribeTransitRouterTrafficQosMarkingEntries
62+
- DescribeTransitRouterTrafficQosMarkingPolicies
63+
64+
--------
65+
66+
Affected versions: `2.0.1` and later
67+
68+
Change description:
69+
70+
Starting from `2.0.1`, the default request protocol changes from **HTTP** to **HTTPS**. After upgrading, ensure you test for compatibility risks. If you must continue using HTTP (not recommended), set `scheme` to `http`:
71+
72+
```python
73+
import volcenginesdkcore
74+
75+
configuration = volcenginesdkcore.Configuration()
76+
configuration.scheme = 'http'
77+
```
78+
79+
## Table of Contents
80+
81+
* Requirements
82+
* Install
83+
* Usage
84+
* FAQ
85+
86+
### Requirements
87+
88+
* Python version **>= 2.7**.
89+
* On Windows, installation may fail due to maximum path length limitations. Configure it as follows:
90+
91+
```
92+
1. Press Win+R, type regedit to open Registry Editor.
93+
2. Set LongPathsEnabled to 1 at:
94+
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
95+
```
96+
97+
### Install
98+
99+
Install via pip:
100+
101+
```sh
102+
pip install volcengine-python-sdk
103+
```
104+
105+
Install via [Setuptools](http://pypi.python.org/pypi/setuptools):
106+
107+
```sh
108+
python setup.py install --user
109+
```
110+
111+
(Or `sudo python setup.py install` to install for all users)
112+
113+
### Configuration Usage
114+
115+
Step 1: initialize and configure global defaults
116+
117+
```python
118+
configuration = volcenginesdkcore.Configuration()
119+
configuration.client_side_validation = True # enable client-side validation
120+
configuration.schema = "http" # https or http
121+
configuration.debug = False
122+
configuration.logger_file = "sdk.log"
123+
124+
volcenginesdkcore.Configuration.set_default(configuration)
125+
```
126+
127+
Step 2: get the client
128+
129+
```python
130+
def get_client(ak, sk, region):
131+
configuration = volcenginesdkcore.Configuration()
132+
configuration.ak = ak
133+
configuration.sk = sk
134+
configuration.region = region
135+
client = volcenginesdkautoscaling.AUTOSCALINGApi(volcenginesdkcore.ApiClient(configuration))
136+
return client
137+
```
138+
139+
### Endpoint Configuration
140+
141+
To customize the endpoint:
142+
143+
```python
144+
configuration = volcenginesdkcore.Configuration()
145+
configuration.host = 'ecs.cn-beijing-autodriving.volcengineapi.com'
146+
```
147+
148+
Standard endpoint rules:
149+
150+
| Regional Service | Global Service |
151+
|---|---|
152+
| `{service}.{region}.volcengineapi.com` <br> e.g. `ecs.cn-beijing-autodriving.volcengineapi.com` | `{service}.volcengineapi.com` <br> e.g. `iam.volcengineapi.com` |
153+
154+
Note:
155+
156+
- If the service name contains `_`, it should be converted to `-` in the endpoint. Use lowercase for all characters.
157+
158+
### SDK Example
159+
160+
```python
161+
from __future__ import print_function
162+
import volcenginesdkecs
163+
import volcenginesdkcore
164+
from pprint import pprint
165+
from volcenginesdkcore.rest import ApiException
166+
167+
if __name__ == '__main__':
168+
configuration = volcenginesdkcore.Configuration()
169+
configuration.ak = "Your AK"
170+
configuration.sk = "Your SK"
171+
configuration.region = "cn-beijing"
172+
configuration.client_side_validation = True
173+
volcenginesdkcore.Configuration.set_default(configuration)
174+
175+
api_instance = volcenginesdkecs.ECSApi()
176+
177+
try:
178+
resp = api_instance.run_instances(
179+
volcenginesdkecs.RunInstancesRequest(
180+
instance_name="insname",
181+
instance_type="ecs.g1.large",
182+
zone_id="cn-beijing-a",
183+
network_interfaces=[volcenginesdkecs.NetworkInterfaceForRunInstancesInput(
184+
subnet_id="subnet-2d68bh73d858ozfekrm8fj",
185+
security_group_ids=["sg-2b3dq7v0ha0w2dx0eg0nhljv"],
186+
)],
187+
image_id="image-ybvz29l3da4ox5h0m9",
188+
volumes=[volcenginesdkecs.VolumeForRunInstancesInput(
189+
volume_type="ESSD",
190+
size=40,
191+
)],
192+
key_pair_name="vtable",
193+
instance_charge_type="PostPaid"
194+
))
195+
pprint(resp)
196+
except ApiException as e:
197+
print("Exception when calling ECSApi->run_instances: %s\n" % e)
198+
```
199+
200+
For more examples, see: [SDK Integration Guide](./SDK_Integration.md)
201+
202+
### FAQ
203+
204+
For common issues when using the SDK, see [FAQ](FAQ.EN.md).
205+

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
1+
中文 | [English](README.EN.MD)
2+
13
# Volcengine SDK for Python
24

5+
## ⚠️ 已知缺陷说明(历史版本)
6+
7+
**volcengine-python-sdk** 的部分历史版本(**4.0.1 ~ 4.0.42,含**)中,发现 SDK 内置的重试机制存在缺陷。
8+
9+
当请求过程中出现异常(如网络抖动、接口返回错误等)时,SDK 虽会触发重试逻辑,但由于该缺陷,重试未能实际生效,客户端仍可能直接感知到首次请求异常,导致重试机制无法有效提升请求成功率。
10+
11+
### 影响范围
12+
13+
- **SDK**:volcengine-python-sdk
14+
- **受影响版本**:4.0.1 ~ 4.0.42(含)
15+
16+
### 影响说明
17+
18+
对于依赖 SDK 内置重试机制来应对瞬时异常或网络不稳定场景的业务:
19+
20+
- 实际请求可用性可能低于预期
21+
- 重试相关配置无法发挥应有的保障作用
22+
23+
### 解决方案与建议
24+
25+
该问题已在 **4.0.43 及以上版本**中修复。
26+
**强烈建议所有用户升级至 volcengine-python-sdk ≥ 4.0.43**,以确保请求重试机制在异常场景下能够正常生效。
27+
28+
329
## 非兼容升级通知
430

531
Volcengine SDK for Python 非兼容升级通知
@@ -184,4 +210,4 @@ if __name__ == '__main__':
184210

185211
### FAQ ###
186212

187-
关于 SDK 使用时碰到的常见问题,请查看 [FAQ](FAQ.md)
213+
关于 SDK 使用时碰到的常见问题,请查看 [FAQ](FAQ.md)

0 commit comments

Comments
 (0)