uapi-sdk-python 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- uapi_sdk_python-0.1.0/PKG-INFO +80 -0
- uapi_sdk_python-0.1.0/README.md +66 -0
- uapi_sdk_python-0.1.0/pyproject.toml +29 -0
- uapi_sdk_python-0.1.0/setup.cfg +4 -0
- uapi_sdk_python-0.1.0/tests/test_client.py +5 -0
- uapi_sdk_python-0.1.0/uapi/__init__.py +2 -0
- uapi_sdk_python-0.1.0/uapi/client.py +2005 -0
- uapi_sdk_python-0.1.0/uapi/errors.py +153 -0
- uapi_sdk_python-0.1.0/uapi_sdk_python.egg-info/PKG-INFO +80 -0
- uapi_sdk_python-0.1.0/uapi_sdk_python.egg-info/SOURCES.txt +11 -0
- uapi_sdk_python-0.1.0/uapi_sdk_python.egg-info/dependency_links.txt +1 -0
- uapi_sdk_python-0.1.0/uapi_sdk_python.egg-info/requires.txt +7 -0
- uapi_sdk_python-0.1.0/uapi_sdk_python.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: uapi-sdk-python
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Idiomatic UAPI SDK for Python
|
|
5
|
+
Author-email: UAPI <dev@uapis.cn>
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: httpx>=0.24.1
|
|
9
|
+
Provides-Extra: dev
|
|
10
|
+
Requires-Dist: pytest; extra == "dev"
|
|
11
|
+
Requires-Dist: mypy; extra == "dev"
|
|
12
|
+
Requires-Dist: black; extra == "dev"
|
|
13
|
+
Requires-Dist: isort; extra == "dev"
|
|
14
|
+
|
|
15
|
+
# uapi-sdk-python
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
[](https://www.python.org/)
|
|
20
|
+
[](https://uapis.cn/)
|
|
21
|
+
|
|
22
|
+
> [!NOTE]
|
|
23
|
+
> 所有接口的 Python 示例都可以在 [UApi](https://uapis.cn/docs/introduction) 的接口文档页面,向下滚动至 **快速启动** 区块后直接复制。
|
|
24
|
+
|
|
25
|
+
## 快速开始
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install uapi-sdk-python
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from uapi import UapiClient
|
|
33
|
+
|
|
34
|
+
client = UapiClient("https://uapis.cn/api/v1")
|
|
35
|
+
result = client.social.get_social_qq_userinfo(qq="10001")
|
|
36
|
+
print(result)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 特性
|
|
40
|
+
|
|
41
|
+
现在你不再需要反反复复的查阅文档了。
|
|
42
|
+
|
|
43
|
+
只需在 IDE 中键入 `client.`,所有核心模块——如 `social`、`game`、`image`——即刻同步展现。进一步输入即可直接定位到 `get_social_qq_userinfo` 这样的具体方法,其名称与文档的 `operationId` 严格保持一致,确保了开发过程的直观与高效。
|
|
44
|
+
|
|
45
|
+
所有方法签名只接受真实且必需的参数。当你在构建请求时,IDE 会即时提示 `qq`、`username` 等键名,这彻底杜绝了在 `dict`/关键字参数中因拼写错误而导致的运行时错误。
|
|
46
|
+
|
|
47
|
+
针对 401、404、429 等标准 HTTP 响应,SDK 已将其统一映射为具名的异常类型。这些异常均附带 `code`、`status`、`details` 等关键上下文信息,确保你在日志中能第一时间准确、快速地诊断问题。
|
|
48
|
+
|
|
49
|
+
`UapiClient(base_url, token, timeout)` 默认使用 `httpx` 并自动追加 `Authorization` 头;需要切换环境或调整超时时,只要改一次构造参数即可。
|
|
50
|
+
|
|
51
|
+
如果你需要查看字段细节或内部逻辑,仓库中的 `./internal` 目录同步保留了由 `openapi-generator` 生成的完整结构体,随时可供参考。
|
|
52
|
+
|
|
53
|
+
## 错误模型概览
|
|
54
|
+
|
|
55
|
+
| HTTP 状态码 | SDK 错误类型 | 附加信息 |
|
|
56
|
+
|-------------|----------------------------------------------|------------------------------------------------------------------------------------|
|
|
57
|
+
| 401/403 | `UnauthorizedError` | `code`、`status` |
|
|
58
|
+
| 404 | `NotFoundError` / `NoMatchError` | `code`、`status` |
|
|
59
|
+
| 400 | `InvalidParameterError` / `InvalidParamsError` | `code`、`status`、`details` |
|
|
60
|
+
| 429 | `ServiceBusyError` | `code`、`status`、`retry_after_seconds`(用于决定何时重试) |
|
|
61
|
+
| 5xx | `InternalServerErrorError` / `ApiErrorError` | `code`、`status`、`details` |
|
|
62
|
+
| 其他 4xx | `UapiError` | `code`、`status`、`details` |
|
|
63
|
+
|
|
64
|
+
## 其他 SDK
|
|
65
|
+
|
|
66
|
+
| 语言 | 仓库地址 |
|
|
67
|
+
|-------------|--------------------------------------------------------------|
|
|
68
|
+
| Go | https://github.com/AxT-Team/uapi-go-sdk |
|
|
69
|
+
| Python(当前) | https://github.com/AxT-Team/uapi-python-sdk |
|
|
70
|
+
| TypeScript| https://github.com/AxT-Team/uapi-typescript-sdk |
|
|
71
|
+
| Browser (TypeScript/JavaScript)| https://github.com/AxT-Team/uapi-browser-sdk |
|
|
72
|
+
| Java | https://github.com/AxT-Team/uapi-java-sdk |
|
|
73
|
+
| PHP | https://github.com/AxT-Team/uapi-php-sdk |
|
|
74
|
+
| C# | https://github.com/AxT-Team/uapi-csharp-sdk |
|
|
75
|
+
| C++ | https://github.com/AxT-Team/uapi-cpp-sdk |
|
|
76
|
+
| Rust | https://github.com/AxT-Team/uapi-rust-sdk |
|
|
77
|
+
|
|
78
|
+
## 文档
|
|
79
|
+
|
|
80
|
+
访问 [UApi文档首页](https://uapis.cn/docs/introduction) 并选择任意接口,向下滚动到 **快速启动** 区块即可看到最新的 Python 示例代码。
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# uapi-sdk-python
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
[](https://www.python.org/)
|
|
6
|
+
[](https://uapis.cn/)
|
|
7
|
+
|
|
8
|
+
> [!NOTE]
|
|
9
|
+
> 所有接口的 Python 示例都可以在 [UApi](https://uapis.cn/docs/introduction) 的接口文档页面,向下滚动至 **快速启动** 区块后直接复制。
|
|
10
|
+
|
|
11
|
+
## 快速开始
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install uapi-sdk-python
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from uapi import UapiClient
|
|
19
|
+
|
|
20
|
+
client = UapiClient("https://uapis.cn/api/v1")
|
|
21
|
+
result = client.social.get_social_qq_userinfo(qq="10001")
|
|
22
|
+
print(result)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 特性
|
|
26
|
+
|
|
27
|
+
现在你不再需要反反复复的查阅文档了。
|
|
28
|
+
|
|
29
|
+
只需在 IDE 中键入 `client.`,所有核心模块——如 `social`、`game`、`image`——即刻同步展现。进一步输入即可直接定位到 `get_social_qq_userinfo` 这样的具体方法,其名称与文档的 `operationId` 严格保持一致,确保了开发过程的直观与高效。
|
|
30
|
+
|
|
31
|
+
所有方法签名只接受真实且必需的参数。当你在构建请求时,IDE 会即时提示 `qq`、`username` 等键名,这彻底杜绝了在 `dict`/关键字参数中因拼写错误而导致的运行时错误。
|
|
32
|
+
|
|
33
|
+
针对 401、404、429 等标准 HTTP 响应,SDK 已将其统一映射为具名的异常类型。这些异常均附带 `code`、`status`、`details` 等关键上下文信息,确保你在日志中能第一时间准确、快速地诊断问题。
|
|
34
|
+
|
|
35
|
+
`UapiClient(base_url, token, timeout)` 默认使用 `httpx` 并自动追加 `Authorization` 头;需要切换环境或调整超时时,只要改一次构造参数即可。
|
|
36
|
+
|
|
37
|
+
如果你需要查看字段细节或内部逻辑,仓库中的 `./internal` 目录同步保留了由 `openapi-generator` 生成的完整结构体,随时可供参考。
|
|
38
|
+
|
|
39
|
+
## 错误模型概览
|
|
40
|
+
|
|
41
|
+
| HTTP 状态码 | SDK 错误类型 | 附加信息 |
|
|
42
|
+
|-------------|----------------------------------------------|------------------------------------------------------------------------------------|
|
|
43
|
+
| 401/403 | `UnauthorizedError` | `code`、`status` |
|
|
44
|
+
| 404 | `NotFoundError` / `NoMatchError` | `code`、`status` |
|
|
45
|
+
| 400 | `InvalidParameterError` / `InvalidParamsError` | `code`、`status`、`details` |
|
|
46
|
+
| 429 | `ServiceBusyError` | `code`、`status`、`retry_after_seconds`(用于决定何时重试) |
|
|
47
|
+
| 5xx | `InternalServerErrorError` / `ApiErrorError` | `code`、`status`、`details` |
|
|
48
|
+
| 其他 4xx | `UapiError` | `code`、`status`、`details` |
|
|
49
|
+
|
|
50
|
+
## 其他 SDK
|
|
51
|
+
|
|
52
|
+
| 语言 | 仓库地址 |
|
|
53
|
+
|-------------|--------------------------------------------------------------|
|
|
54
|
+
| Go | https://github.com/AxT-Team/uapi-go-sdk |
|
|
55
|
+
| Python(当前) | https://github.com/AxT-Team/uapi-python-sdk |
|
|
56
|
+
| TypeScript| https://github.com/AxT-Team/uapi-typescript-sdk |
|
|
57
|
+
| Browser (TypeScript/JavaScript)| https://github.com/AxT-Team/uapi-browser-sdk |
|
|
58
|
+
| Java | https://github.com/AxT-Team/uapi-java-sdk |
|
|
59
|
+
| PHP | https://github.com/AxT-Team/uapi-php-sdk |
|
|
60
|
+
| C# | https://github.com/AxT-Team/uapi-csharp-sdk |
|
|
61
|
+
| C++ | https://github.com/AxT-Team/uapi-cpp-sdk |
|
|
62
|
+
| Rust | https://github.com/AxT-Team/uapi-rust-sdk |
|
|
63
|
+
|
|
64
|
+
## 文档
|
|
65
|
+
|
|
66
|
+
访问 [UApi文档首页](https://uapis.cn/docs/introduction) 并选择任意接口,向下滚动到 **快速启动** 区块即可看到最新的 Python 示例代码。
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "uapi-sdk-python"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Idiomatic UAPI SDK for Python"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
authors = [{name = "UAPI", email = "dev@uapis.cn"}]
|
|
12
|
+
dependencies = ["httpx>=0.24.1"]
|
|
13
|
+
|
|
14
|
+
[project.optional-dependencies]
|
|
15
|
+
dev = ["pytest", "mypy", "black", "isort"]
|
|
16
|
+
|
|
17
|
+
[tool.setuptools.packages.find]
|
|
18
|
+
include = ["uapi*"]
|
|
19
|
+
exclude = ["internal*"]
|
|
20
|
+
|
|
21
|
+
[tool.black]
|
|
22
|
+
line-length = 100
|
|
23
|
+
|
|
24
|
+
[tool.mypy]
|
|
25
|
+
python_version = 3.11
|
|
26
|
+
strict = true
|
|
27
|
+
|
|
28
|
+
[tool.isort]
|
|
29
|
+
profile = "black"
|