|
1 | | -# Alibaba Cloud Python Software Development Kit (V1.0 - Deprecated) |
| 1 | +# Alibaba Cloud Developer Python Toolkit (V1.0 - Deprecated) |
2 | 2 |
|
3 | 3 | [](https://badge.fury.io/py/aliyun-python-sdk-core) |
4 | 4 | [](https://github.com/aliyun/aliyun-openapi-python-sdk/actions/workflows/test.yml) |
5 | 5 | [](https://codecov.io/gh/aliyun/aliyun-openapi-python-sdk) |
6 | 6 | [](https://img.shields.io/pypi/pyversions/aliyun-python-sdk-core.svg) |
7 | 7 |
|
8 | | -[English](./README.md) | [中文文档](./README_zh.md) |
| 8 | +⚠️ **Important Notice**: Alibaba Cloud Python SDK V1.0 has entered the basic security maintenance phase and is no longer recommended for use. It is **strongly recommended** to use the [V2.0 SDK](https://github.com/aliyun/alibabacloud-python-sdk). |
9 | 9 |
|
10 | | -⚠️ **重要通知**: 阿里云 Python SDK V1.0 已进入基础安全维护阶段,不再推荐使用。**强烈建议**使用 [V2.0 SDK](https://github.com/aliyun/alibabacloud-python-sdk)。 |
| 10 | +## 🚨 Important Statement |
11 | 11 |
|
12 | | -## 🚨 重要声明 |
| 12 | +**V1.0 SDK Status**: |
| 13 | +- Currently in basic security maintenance phase |
| 14 | +- No new features will be added |
13 | 15 |
|
14 | | -**V1.0 SDK状态**: |
15 | | -- 当前处于基础安全维护阶段 |
16 | | -- 不再添加新功能 |
| 16 | +**Migration Recommendations**: |
| 17 | +- New projects should directly use the [V2.0 SDK](https://github.com/aliyun/alibabacloud-python-sdk) |
| 18 | +- Existing V1.0 projects are advised to migrate to V2.0 as soon as possible |
| 19 | +- V2.0 provides better performance, a more concise API, and more complete documentation |
17 | 20 |
|
18 | | -**迁移建议**: |
19 | | -- 新项目请直接使用 [V2.0 SDK](https://github.com/aliyun/alibabacloud-python-sdk) |
20 | | -- 现有V1.0项目建议尽快迁移至V2.0 |
21 | | -- V2.0提供更好的性能、更简洁的API和更完善的文档 |
| 21 | +## 🔗 V2.0 SDK Resources |
22 | 22 |
|
23 | | -## 🔗 V2.0 SDK 资源 |
| 23 | +**GitHub Repository**: [https://github.com/aliyun/alibabacloud-python-sdk](https://github.com/aliyun/alibabacloud-python-sdk) |
24 | 24 |
|
25 | | -**GitHub仓库**: [https://github.com/aliyun/alibabacloud-python-sdk](https://github.com/aliyun/alibabacloud-python-sdk) |
| 25 | +**Official Documentation**: [https://help.aliyun.com/zh/sdk/developer-reference/v2-python-integrated-sdk](https://help.aliyun.com/zh/sdk/developer-reference/v2-python-integrated-sdk) |
26 | 26 |
|
27 | | -**官方文档**: [https://help.aliyun.com/zh/sdk/developer-reference/v2-python-integrated-sdk](https://help.aliyun.com/zh/sdk/developer-reference/v2-python-integrated-sdk) |
| 27 | +**Developer Portal**: [https://api.aliyun.com](https://api.aliyun.com) |
28 | 28 |
|
29 | | -**开发者门户**: [https://api.aliyun.com](https://api.aliyun.com) |
| 29 | +## 🛠 Instructions for Continuing to Use V1.0 SDK |
30 | 30 |
|
31 | | -## 🛠 V1.0 SDK 继续使用说明 |
| 31 | +If you still need to use the V1.0 SDK, please continue reading the following content: |
32 | 32 |
|
33 | | -如果您仍需要使用V1.0 SDK,请继续阅读以下内容: |
| 33 | +## Troubleshooting |
34 | 34 |
|
35 | | -## 🆘 故障诊断 |
| 35 | +[Troubleshoot](https://api.aliyun.com/troubleshoot?source=github_sdk) provides OpenAPI usage diagnostics. By entering the `RequestID` or `error message`, it helps developers quickly locate issues and provides corresponding solutions. |
36 | 36 |
|
37 | | -[Troubleshoot](https://api.aliyun.com/troubleshoot?source=github_sdk) 提供OpenAPI使用诊断服务,通过 `RequestID` 或 `报错信息` 帮助开发者快速定位问题并提供解决方案。 |
| 37 | +## Online Examples |
38 | 38 |
|
39 | | -## 🌐 在线示例 |
| 39 | +The **[Developer Portal](https://api.aliyun.com)** provides capabilities such as invoking cloud product OpenAPIs online, dynamically generating SDK example code, and quickly searching for APIs. This can significantly reduce the difficulty of using cloud APIs and is highly recommended. |
40 | 40 |
|
41 | | -**[开发者门户](https://api.aliyun.com)** 提供在线调用云产品OpenAPI、动态生成SDK示例代码和快速检索接口等功能,能显著降低使用云API的难度。**强烈推荐使用**。 |
| 41 | +<a href="https://api.aliyun.com" target="api_explorer"> |
| 42 | + <img src="https://img.alicdn.com/tfs/TB12GX6zW6qK1RjSZFmXXX0PFXa-744-122.png" width="180" /> |
| 43 | +</a> |
42 | 44 |
|
43 | | -## ⚠️ 重要更新 |
| 45 | +## Important Updates |
44 | 46 |
|
45 | | -- 从版本2.16.0开始,阿里云Python SDK核心库 `aliyun-python-sdk-core` 仅支持Python 3.7及以上版本 |
46 | | -- V1.0 SDK将不再接收新功能更新 |
47 | | -- 建议尽快迁移到V2.0 SDK以获得更好的支持和功能 |
| 47 | +- Starting from version 2.16.0, the core library of Alibaba Cloud Python SDK, `aliyun-python-sdk-core`, only supports Python 3.7 and above. |
| 48 | +- The V1.0 SDK will no longer receive new feature updates. |
| 49 | +- It is recommended to migrate to the V2.0 SDK as soon as possible to gain better support and features. |
48 | 50 |
|
49 | | -## 📚 V1.0 文档 |
| 51 | +## Documentation |
50 | 52 |
|
51 | | -- [环境要求](docs/0-Requirement-EN.md) |
52 | | -- [安装](./docs/1-Installation-EN.md) |
53 | | -- [客户端与凭证](./docs/2-Client-EN.md) |
54 | | -- [超时机制](./docs/3-Timeout-EN.md) |
55 | | -- [代理配置](./docs/4-Proxy-EN.md) |
56 | | -- [日志](./docs/5-Log-EN.md) |
57 | | -- [域名](./docs/6-Endpoint-EN.md) |
58 | | -- [Https配置](./docs/7-Https-EN.md) |
59 | | -- [调试](./docs/8-Debug-EN.md) |
60 | | -- [异常处理](./docs/9-Exception-EN.md) |
| 53 | +- [Environment Requirements](./docs/0-Requirement-CN.md) |
| 54 | +- [Installation](./docs/1-Installation-CN.md) |
| 55 | +- [Client and Credentials](./docs/2-Client-CN.md) |
| 56 | +- [Timeout Mechanism](./docs/3-Timeout-CN.md) |
| 57 | +- [Proxy Configuration](./docs/4-Proxy-CN.md) |
| 58 | +- [Logging](./docs/5-Log-CN.md) |
| 59 | +- [Endpoints](./docs/6-Endpoint-CN.md) |
| 60 | +- [HTTPS Configuration](./docs/7-Https-CN.md) |
| 61 | +- [Debugging](./docs/8-Debug-CN.md) |
| 62 | +- [Exceptions](./docs/9-Exception-CN.md) |
61 | 63 |
|
62 | | -## 📋 前提条件 |
| 64 | +## Environment Preparation |
63 | 65 |
|
64 | | -- 使用阿里云Python SDK需要拥有阿里云账号以及AccessKey |
| 66 | +1. To use the Alibaba Cloud Python SDK, you need a cloud account and a pair of `Access Key ID` and `Access Key Secret`. Please create and view your Access Keys on the [AccessKey management page](https://usercenter.console.aliyun.com/?spm=5176.doc52740.2.3.QKZk8w#/manage/ak) in the Alibaba Cloud console, or contact your system administrator. |
| 67 | +2. To use the Alibaba Cloud SDK to access the API of a specific product, you must first activate that product in the [Alibaba Cloud Console](https://home.console.aliyun.com/?spm=5176.doc52740.2.4.QKZk8w). |
65 | 68 |
|
66 | | - 初始化 `AcsClient` 时需要AccessKey。您可以在阿里云控制台创建AccessKey。更多信息请参见[创建AccessKey](https://usercenter.console.aliyun.com/?spm=5176.doc52740.2.3.QKZk8w#/manage/ak)。 |
| 69 | +## Getting and Installing the SDK |
67 | 70 |
|
68 | | - > **注意:** 为了提高账号安全性,建议使用RAM用户的AccessKey访问阿里云服务。 |
| 71 | +### Install via pip (Recommended) |
69 | 72 |
|
70 | | -- 使用阿里云Python SDK访问产品API前,如需要请先在[阿里云控制台](https://home.console.aliyun.com/?spm=5176.doc52740.2.4.QKZk8w)开通该产品。 |
71 | | - |
72 | | -- 阿里云Python SDK要求Python 3.7.x及以上版本。 |
73 | | - |
74 | | -## 📦 安装Python SDK |
75 | | - |
76 | | -阿里云Python SDK支持Python 3.7.x及以上版本。运行 ``python --version`` 检查您的Python版本。 |
77 | | - |
78 | | -您可以使用以下两种方法安装阿里云Python SDK。无论使用哪种方法和云服务,都必须安装核心库 `aliyun-python-sdk-core`。 |
79 | | - |
80 | | -- **使用pip安装(推荐)** |
81 | | - |
82 | | - Python SDK使用名为 `pip` 的通用包管理工具。如果未安装pip,请参见[pip用户指南](https://pip.pypa.io/en/stable/installing/?spm=5176.doc53090.2.7.zHDiNV "pip User Guide")安装pip。 |
83 | | - |
84 | | - 运行以下命令安装阿里云服务的各个库: |
85 | | - |
86 | | - ```bash |
87 | | - # 安装核心库 |
88 | | - pip install aliyun-python-sdk-core |
89 | | - # 安装ECS管理库 |
90 | | - pip install aliyun-python-sdk-ecs |
91 | | - # 安装RDS管理库 |
92 | | - pip install aliyun-python-sdk-rds |
93 | | - ``` |
94 | | - |
95 | | -## 🚀 使用Python SDK |
96 | | - |
97 | | -1. 导入所需模块: |
98 | | - |
99 | | - ```python |
100 | | - from aliyunsdkcore.client import AcsClient |
101 | | - from aliyunsdkcore.acs_exception.exceptions import ClientException |
102 | | - from aliyunsdkcore.acs_exception.exceptions import ServerException |
103 | | - from aliyunsdkecs.request.v20140526 import DescribeInstancesRequest |
104 | | - from aliyunsdkecs.request.v20140526 import StopInstanceRequest |
105 | | - ``` |
106 | | -2. 初始化 `AcsClient` 实例: |
107 | | - |
108 | | - ```python |
109 | | - client = AcsClient( |
110 | | - "<access-key-id>", |
111 | | - "<access-key-secret>", |
112 | | - "<region-id>" |
113 | | - ) |
114 | | - ``` |
115 | | - |
116 | | - 其中: |
117 | | - |
118 | | - - `access-key-id` 是您账号的AccessKey ID。 |
119 | | - - `access-key-secret` 是您账号的AccessKey Secret。 |
120 | | - - `region-id` 是调用服务的区域ID。区域ID列表请参见[地域和可用区](https://www.alibabacloud.com/help/doc-detail/40654.html)。 |
121 | | - |
122 | | - > **注意:** 这些参数的顺序不能更改。 |
123 | | - |
124 | | -3. 初始化请求并打印响应: |
| 73 | +```bash |
| 74 | +pip install aliyun-python-sdk-core # Install the Alibaba Cloud SDK core library |
| 75 | +pip install aliyun-python-sdk-ecs # Install the ECS management SDK |
| 76 | +``` |
125 | 77 |
|
126 | | - ```python |
127 | | - # 初始化请求并设置参数 |
128 | | - request = DescribeInstancesRequest.DescribeInstancesRequest() |
129 | | - request.set_PageSize(10) |
130 | | - # 打印响应 |
131 | | - response = client.do_action_with_exception(request) |
132 | | - print response |
133 | | - ``` |
| 78 | +## Getting Started |
134 | 79 |
|
135 | | -## 💻 代码示例 |
| 80 | +The following code example demonstrates the three main steps for calling the Alibaba Cloud Python SDK: |
136 | 81 |
|
137 | | -以下示例展示了如何使用[DescribeInstances](~~25506~~)查询特定区域的ECS实例列表。请替换 `your-access-key-id`、`your-access-key-secret` 和 `your-region-id` 的值。 |
| 82 | +1. Create a Client instance |
| 83 | +2. Create an API request and set parameters |
| 84 | +3. Send the request and handle exceptions |
138 | 85 |
|
139 | 86 | ```python |
140 | 87 | # -*- coding: utf8 -*- |
141 | | - |
142 | 88 | from aliyunsdkcore.client import AcsClient |
143 | 89 | from aliyunsdkcore.acs_exception.exceptions import ClientException |
144 | 90 | from aliyunsdkcore.acs_exception.exceptions import ServerException |
145 | 91 | from aliyunsdkecs.request.v20140526 import DescribeInstancesRequest |
146 | 92 | from aliyunsdkecs.request.v20140526 import StopInstanceRequest |
147 | 93 |
|
148 | | -# 初始化AcsClient实例 |
| 94 | +# Create an AcsClient instance |
149 | 95 | client = AcsClient( |
150 | | - "<your-access-key-id>", |
151 | | - "<your-access-key-secret>", |
152 | | - "<your-region-id>" |
| 96 | + "<your-access-key-id>", |
| 97 | + "<your-access-key-secret>", |
| 98 | + "<your-region-id>" |
153 | 99 | ) |
154 | 100 |
|
155 | | -# 初始化请求并设置参数 |
| 101 | +# Create a request and set parameters |
156 | 102 | request = DescribeInstancesRequest.DescribeInstancesRequest() |
157 | 103 | request.set_PageSize(10) |
158 | 104 |
|
159 | | -# 打印响应 |
| 105 | +# Send the API request and print the response |
160 | 106 | response = client.do_action_with_exception(request) |
161 | 107 | print response |
162 | 108 | ``` |
163 | 109 |
|
164 | | -## 🐛 HTTP调试 |
| 110 | +When creating the Client instance, you need to provide three parameters: Region ID, Access Key ID, and Access Key Secret. Access Key ID and Access Key Secret can be obtained from the console, and Region ID can be found in the [Region List](https://help.aliyun.com/document_detail/40654.html). |
165 | 111 |
|
166 | | -要使用 `HTTP DEBUG` 功能,您必须在环境变量中设置 `DEBUG`,对应的值可以是 `sdk` 或 `SDK`。 |
| 112 | +## HTTP DEBUG |
167 | 113 |
|
168 | | -以下示例展示了 `HTTP DEBUG` 的作用,这将帮助您调试代码: |
| 114 | +To use the HTTP DEBUG feature, you need to set the `DEBUG` environment variable in your environment. Its value can be either `sdk` or `SDK`. |
169 | 115 |
|
170 | | -```plaintext |
| 116 | +**HTTP DEBUG** displays the following information to help you debug your code: |
| 117 | + |
| 118 | +``` |
171 | 119 | > GET /databases?RegionId=cn-hangzhou HTTP/1.1 |
172 | 120 | > Host : ads.cn-hangzhou.aliyuncs.com |
173 | 121 | > User-Agent : AlibabaCloud (Windows 10;AMD64) Python/3.7.1 Core/2.13.1 python-requests/2.18.1 |
@@ -196,14 +144,14 @@ print response |
196 | 144 | < Server : Jetty(7.2.2.v20101205) |
197 | 145 | ``` |
198 | 146 |
|
199 | | -## 🤝 贡献 |
| 147 | +## Contributing |
200 | 148 |
|
201 | | -请确保在提交pull request之前阅读[贡献指南](CONTRIBUTING.md)。 |
| 149 | +Please make sure to read the [Contributing Guide](CONTRIBUTING.md) before submitting a pull request. |
202 | 150 |
|
203 | | -## 📄 许可证 |
| 151 | +## License |
204 | 152 |
|
205 | 153 | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0) |
206 | 154 |
|
207 | 155 | --- |
208 | 156 |
|
209 | | -**推荐使用 [V2.0 SDK](https://github.com/aliyun/alibabacloud-python-sdk) 获得更好的开发体验!** 🚀 |
| 157 | +**We recommend using the [V2.0 SDK](https://github.com/aliyun/alibabacloud-python-sdk) for a better development experience!** 🚀 |
0 commit comments