Skip to content

Commit 8b3c9b0

Browse files
committed
feat: readme en doc
1 parent 85e2fad commit 8b3c9b0

4 files changed

Lines changed: 801 additions & 2 deletions

File tree

README.EN.MD

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
English | [中文](README.md)
2+
3+
# Volcengine SDK for Python
4+
5+
## Breaking Change Notice
6+
7+
Breaking change notice for Volcengine SDK for Python.
8+
9+
Affected versions: `3.0.1` and later
10+
11+
Change description:
12+
13+
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:
14+
15+
```python
16+
from volcenginesdktransitrouter import TransitRouterBandwidthPackageForDescribeTransitRouterBandwidthPackagesOutput
17+
18+
var = TransitRouterBandwidthPackageForDescribeTransitRouterBandwidthPackagesOutput()
19+
```
20+
21+
Impacted service and APIs:
22+
23+
Service: `transitrouter`
24+
25+
Version: `2020-04-01`
26+
27+
APIs:
28+
29+
- DescribeTransitRouterBandwidthPackages
30+
- DescribeTransitRouterRoutePolicyTables
31+
- DescribeTransitRouterRoutePolicyEntries
32+
- DescribeTransitRouterForwardPolicyTables
33+
- DescribeTransitRouterBandwidthPackagesBilling
34+
- DescribeTransitRouterDirectConnectGatewayAttachments
35+
- DescribeTransitRouterRouteTableAssociations
36+
- DescribeTransitRouterRouteTablePropagations
37+
- DescribeTransitRouterTrafficQosQueueEntries
38+
- DescribeTransitRouterTrafficQosQueuePolicies
39+
- DescribeTransitRouterTrafficQosMarkingEntries
40+
- DescribeTransitRouterTrafficQosMarkingPolicies
41+
42+
--------
43+
44+
Affected versions: `2.0.1` and later
45+
46+
Change description:
47+
48+
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`:
49+
50+
```python
51+
import volcenginesdkcore
52+
53+
configuration = volcenginesdkcore.Configuration()
54+
configuration.scheme = 'http'
55+
```
56+
57+
## Table of Contents
58+
59+
* Requirements
60+
* Install
61+
* Usage
62+
* FAQ
63+
64+
### Requirements
65+
66+
* Python version **>= 2.7**.
67+
* On Windows, installation may fail due to maximum path length limitations. Configure it as follows:
68+
69+
```
70+
1. Press Win+R, type regedit to open Registry Editor.
71+
2. Set LongPathsEnabled to 1 at:
72+
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
73+
```
74+
75+
### Install
76+
77+
Install via pip:
78+
79+
```sh
80+
pip install volcengine-python-sdk
81+
```
82+
83+
Install via [Setuptools](http://pypi.python.org/pypi/setuptools):
84+
85+
```sh
86+
python setup.py install --user
87+
```
88+
89+
(Or `sudo python setup.py install` to install for all users)
90+
91+
### Configuration Usage
92+
93+
Step 1: initialize and configure global defaults
94+
95+
```python
96+
configuration = volcenginesdkcore.Configuration()
97+
configuration.client_side_validation = True # enable client-side validation
98+
configuration.schema = "http" # https or http
99+
configuration.debug = False
100+
configuration.logger_file = "sdk.log"
101+
102+
volcenginesdkcore.Configuration.set_default(configuration)
103+
```
104+
105+
Step 2: get the client
106+
107+
```python
108+
def get_client(ak, sk, region):
109+
configuration = volcenginesdkcore.Configuration()
110+
configuration.ak = ak
111+
configuration.sk = sk
112+
configuration.region = region
113+
client = volcenginesdkautoscaling.AUTOSCALINGApi(volcenginesdkcore.ApiClient(configuration))
114+
return client
115+
```
116+
117+
### Endpoint Configuration
118+
119+
To customize the endpoint:
120+
121+
```python
122+
configuration = volcenginesdkcore.Configuration()
123+
configuration.host = 'ecs.cn-beijing-autodriving.volcengineapi.com'
124+
```
125+
126+
Standard endpoint rules:
127+
128+
| Regional Service | Global Service |
129+
|---|---|
130+
| `{service}.{region}.volcengineapi.com` <br> e.g. `ecs.cn-beijing-autodriving.volcengineapi.com` | `{service}.volcengineapi.com` <br> e.g. `iam.volcengineapi.com` |
131+
132+
Note:
133+
134+
- If the service name contains `_`, it should be converted to `-` in the endpoint. Use lowercase for all characters.
135+
136+
### SDK Example
137+
138+
```python
139+
from __future__ import print_function
140+
import volcenginesdkecs
141+
import volcenginesdkcore
142+
from pprint import pprint
143+
from volcenginesdkcore.rest import ApiException
144+
145+
if __name__ == '__main__':
146+
configuration = volcenginesdkcore.Configuration()
147+
configuration.ak = "Your AK"
148+
configuration.sk = "Your SK"
149+
configuration.region = "cn-beijing"
150+
configuration.client_side_validation = True
151+
volcenginesdkcore.Configuration.set_default(configuration)
152+
153+
api_instance = volcenginesdkecs.ECSApi()
154+
155+
try:
156+
resp = api_instance.run_instances(
157+
volcenginesdkecs.RunInstancesRequest(
158+
instance_name="insname",
159+
instance_type="ecs.g1.large",
160+
zone_id="cn-beijing-a",
161+
network_interfaces=[volcenginesdkecs.NetworkInterfaceForRunInstancesInput(
162+
subnet_id="subnet-2d68bh73d858ozfekrm8fj",
163+
security_group_ids=["sg-2b3dq7v0ha0w2dx0eg0nhljv"],
164+
)],
165+
image_id="image-ybvz29l3da4ox5h0m9",
166+
volumes=[volcenginesdkecs.VolumeForRunInstancesInput(
167+
volume_type="ESSD",
168+
size=40,
169+
)],
170+
key_pair_name="vtable",
171+
instance_charge_type="PostPaid"
172+
))
173+
pprint(resp)
174+
except ApiException as e:
175+
print("Exception when calling ECSApi->run_instances: %s\n" % e)
176+
```
177+
178+
For more examples, see: [SDK Integration Guide](./SDK_Integration.md)
179+
180+
### FAQ
181+
182+
For common issues when using the SDK, see [FAQ](FAQ.md).

README.md

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

35
## 非兼容升级通知
@@ -184,4 +186,4 @@ if __name__ == '__main__':
184186

185187
### FAQ ###
186188

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

0 commit comments

Comments
 (0)