py-tiehu-toolkit 1.0.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 郭磊
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,233 @@
1
+ Metadata-Version: 2.4
2
+ Name: py-tiehu-toolkit
3
+ Version: 1.0.0
4
+ Summary: py-tiehu 是铁虎管理系统的 Python SDK,提供同步和异步两种调用方式,实现完整的请求签名机制,用于与铁虎停车场管理系统(Parking)和 SCMP 进行 API 交互。
5
+ Author-email: Guolei <174000902@qq.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 郭磊
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://gitee.com/guolei19850528/py_tiehu_toolkit
29
+ Project-URL: Repository, https://gitee.com/guolei19850528/py_tiehu_toolkit.git
30
+ Project-URL: Documentation, https://www.showdoc.com.cn/1735808258920310/9467753400037587
31
+ Keywords: tiehu,python,client,api,铁虎,parking,scmp
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Development Status :: 4 - Beta
34
+ Classifier: Intended Audience :: Developers
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.10
37
+ Classifier: Programming Language :: Python :: 3.11
38
+ Classifier: Programming Language :: Python :: 3.12
39
+ Classifier: Programming Language :: Python :: 3.13
40
+ Classifier: Operating System :: OS Independent
41
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
42
+ Classifier: Topic :: Internet :: WWW/HTTP
43
+ Classifier: Topic :: Internet :: WWW/HTTP :: Session
44
+ Classifier: Typing :: Typed
45
+ Requires-Python: >=3.10
46
+ Description-Content-Type: text/markdown
47
+ License-File: LICENSE
48
+ Requires-Dist: httpx>=0.27.0
49
+ Requires-Dist: pydantic>=2.0
50
+ Requires-Dist: jsonpath-ng>=1.5.3
51
+ Requires-Dist: jsonschema>=4.21.0
52
+ Requires-Dist: py-httpx-toolkit>=1.0.1
53
+ Provides-Extra: dev
54
+ Requires-Dist: pytest>=7.0; extra == "dev"
55
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
56
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
57
+ Requires-Dist: setuptools>=61.0; extra == "dev"
58
+ Requires-Dist: twine>=4.0; extra == "dev"
59
+ Requires-Dist: black>=23.0; extra == "dev"
60
+ Requires-Dist: isort>=5.12.0; extra == "dev"
61
+ Requires-Dist: flake8>=6.0; extra == "dev"
62
+ Requires-Dist: mypy>=1.0; extra == "dev"
63
+ Dynamic: license-file
64
+
65
+ # py-tiehu-toolkit
66
+
67
+ 铁虎管理系统 API Python SDK,提供同步和异步两种调用方式,实现完整的请求签名机制,用于与铁虎停车场管理系统(Parking)和 SCMP 进行 API 交互。
68
+
69
+ ## 功能特性
70
+
71
+ - ✅ 自动生成请求签名/Token(MD5 算法)
72
+ - ✅ 支持同步/异步 HTTP 请求
73
+ - ✅ 自动添加公共请求参数
74
+ - ✅ Pydantic 响应模型支持
75
+ - ✅ JSON Schema 响应校验
76
+ - ✅ JSONPath 数据查询
77
+
78
+ ## 项目结构
79
+
80
+ ```
81
+ src/py_tiehu_toolkit/
82
+ ├── __init__.py # 模块入口
83
+ ├── parking/ # 停车场模块
84
+ │ ├── __init__.py # Pklot 客户端类
85
+ │ ├── utils.py # 工具函数
86
+ │ └── responses.py # 响应数据模型
87
+ └── scmp/ # SCMP 模块
88
+ ├── __init__.py # Scmp 客户端类
89
+ ├── utils.py # 工具函数
90
+ └── responses.py # 响应数据模型
91
+ ```
92
+
93
+ ## 安装方式
94
+
95
+ ### 使用 pip
96
+
97
+ ```bash
98
+ pip install py-tiehu-toolkit
99
+ ```
100
+
101
+ ### 使用 uv(推荐)
102
+
103
+ ```bash
104
+ uv add py-tiehu-toolkit
105
+ ```
106
+
107
+ ### 从源码安装
108
+
109
+ ```bash
110
+ git clone https://gitee.com/guolei19850528/py_tiehu_toolkit.git
111
+ cd py_tiehu_toolkit
112
+ uv install .
113
+ ```
114
+
115
+ ## 依赖包
116
+
117
+ | 依赖 | 版本要求 | 说明 |
118
+ |------|----------|------|
119
+ | httpx | >=0.27.0 | HTTP 客户端库,支持同步和异步 |
120
+ | pydantic | >=2.0 | 数据验证和序列化 |
121
+ | jsonpath-ng | >=1.5.3 | JSONPath 查询支持 |
122
+ | jsonschema | >=4.21.0 | JSON Schema 校验 |
123
+ | py-httpx-toolkit | >=1.0.1 | HTTP 工具包封装 |
124
+
125
+ ## 快速开始
126
+
127
+ ### 停车场模块 (Parking)
128
+
129
+ ```python
130
+ from py_tiehu_toolkit.parking import Pklot
131
+ from py_tiehu_toolkit.parking.utils import build_success_instance, timestamp
132
+
133
+ # 创建同步客户端
134
+ pklot = Pklot(
135
+ base_url="https://isc.example.com",
136
+ parking_id="park001",
137
+ app_key="your_app_secret"
138
+ )
139
+
140
+ # 发送请求
141
+ response = pklot.request_with_signature(url="/api/v1/query")
142
+
143
+ # 转换为响应模型
144
+ result = build_success_instance(response)
145
+ print(result.status)
146
+ print(result.Data)
147
+ ```
148
+
149
+ ### SCMP 模块
150
+
151
+ ```python
152
+ from py_tiehu_toolkit.scmp import Scmp
153
+ from py_tiehu_toolkit.scmp.utils import build_success_instance
154
+
155
+ # 创建同步客户端
156
+ scmp = Scmp(
157
+ base_url="https://scmp.example.com",
158
+ appid="app001",
159
+ secret="your_secret"
160
+ )
161
+
162
+ # 发送请求
163
+ response = scmp.request_with_token(url="/api/v1/data")
164
+
165
+ # 转换为响应模型
166
+ result = build_success_instance(response)
167
+ print(result.code)
168
+ print(result.Data)
169
+ ```
170
+
171
+ ### 异步调用
172
+
173
+ ```python
174
+ import asyncio
175
+ from py_tiehu_toolkit.parking import Pklot
176
+
177
+ async def main():
178
+ pklot = Pklot(
179
+ base_url="https://isc.example.com",
180
+ parking_id="park001",
181
+ app_key="your_app_secret"
182
+ )
183
+
184
+ # 异步请求
185
+ response = await pklot.async_request_with_signature(url="/api/v1/query")
186
+ print(response.json())
187
+
188
+ asyncio.run(main())
189
+ ```
190
+
191
+ ## API 参考
192
+
193
+ ### parking.Pklot 类
194
+
195
+ | 方法 | 说明 |
196
+ |------|------|
197
+ | `__init__(base_url, parking_id, app_key, client_kwargs)` | 初始化客户端 |
198
+ | `signature(data)` | 生成请求签名 |
199
+ | `request_with_signature(client, client_kwargs, **kwargs)` | 同步请求(带签名) |
200
+ | `async_request_with_signature(client, client_kwargs, **kwargs)` | 异步请求(带签名) |
201
+
202
+ ### scmp.Scmp 类
203
+
204
+ | 方法 | 说明 |
205
+ |------|------|
206
+ | `__init__(base_url, appid, secret, client_kwargs)` | 初始化客户端 |
207
+ | `token(ts)` | 生成请求 Token |
208
+ | `request_with_token(client, client_kwargs, **kwargs)` | 同步请求(带 Token) |
209
+ | `async_request_with_token(client, client_kwargs, **kwargs)` | 异步请求(带 Token) |
210
+
211
+ ### utils 工具函数
212
+
213
+ | 函数 | 说明 |
214
+ |------|------|
215
+ | `timestamp()` | 生成毫秒级时间戳 |
216
+ | `json_find_first(expression, data)` | JSONPath 查询 |
217
+ | `json_is_valid(schema, data)` | JSON Schema 校验 |
218
+ | `build_success_instance(response)` | 响应转模型 |
219
+ | `success_is_valid(response, schema)` | 校验成功响应 |
220
+
221
+
222
+ ## 作者
223
+
224
+ **Guolei** - <174000902@qq.com>
225
+
226
+ ## 项目主页
227
+
228
+ - **仓库**: https://gitee.com/guolei19850528/py_tiehu_toolkit
229
+ - **官方文档**: https://www.showdoc.com.cn/1735808258920310/9467753400037587
230
+
231
+ ## 许可证
232
+
233
+ MIT License
@@ -0,0 +1,169 @@
1
+ # py-tiehu-toolkit
2
+
3
+ 铁虎管理系统 API Python SDK,提供同步和异步两种调用方式,实现完整的请求签名机制,用于与铁虎停车场管理系统(Parking)和 SCMP 进行 API 交互。
4
+
5
+ ## 功能特性
6
+
7
+ - ✅ 自动生成请求签名/Token(MD5 算法)
8
+ - ✅ 支持同步/异步 HTTP 请求
9
+ - ✅ 自动添加公共请求参数
10
+ - ✅ Pydantic 响应模型支持
11
+ - ✅ JSON Schema 响应校验
12
+ - ✅ JSONPath 数据查询
13
+
14
+ ## 项目结构
15
+
16
+ ```
17
+ src/py_tiehu_toolkit/
18
+ ├── __init__.py # 模块入口
19
+ ├── parking/ # 停车场模块
20
+ │ ├── __init__.py # Pklot 客户端类
21
+ │ ├── utils.py # 工具函数
22
+ │ └── responses.py # 响应数据模型
23
+ └── scmp/ # SCMP 模块
24
+ ├── __init__.py # Scmp 客户端类
25
+ ├── utils.py # 工具函数
26
+ └── responses.py # 响应数据模型
27
+ ```
28
+
29
+ ## 安装方式
30
+
31
+ ### 使用 pip
32
+
33
+ ```bash
34
+ pip install py-tiehu-toolkit
35
+ ```
36
+
37
+ ### 使用 uv(推荐)
38
+
39
+ ```bash
40
+ uv add py-tiehu-toolkit
41
+ ```
42
+
43
+ ### 从源码安装
44
+
45
+ ```bash
46
+ git clone https://gitee.com/guolei19850528/py_tiehu_toolkit.git
47
+ cd py_tiehu_toolkit
48
+ uv install .
49
+ ```
50
+
51
+ ## 依赖包
52
+
53
+ | 依赖 | 版本要求 | 说明 |
54
+ |------|----------|------|
55
+ | httpx | >=0.27.0 | HTTP 客户端库,支持同步和异步 |
56
+ | pydantic | >=2.0 | 数据验证和序列化 |
57
+ | jsonpath-ng | >=1.5.3 | JSONPath 查询支持 |
58
+ | jsonschema | >=4.21.0 | JSON Schema 校验 |
59
+ | py-httpx-toolkit | >=1.0.1 | HTTP 工具包封装 |
60
+
61
+ ## 快速开始
62
+
63
+ ### 停车场模块 (Parking)
64
+
65
+ ```python
66
+ from py_tiehu_toolkit.parking import Pklot
67
+ from py_tiehu_toolkit.parking.utils import build_success_instance, timestamp
68
+
69
+ # 创建同步客户端
70
+ pklot = Pklot(
71
+ base_url="https://isc.example.com",
72
+ parking_id="park001",
73
+ app_key="your_app_secret"
74
+ )
75
+
76
+ # 发送请求
77
+ response = pklot.request_with_signature(url="/api/v1/query")
78
+
79
+ # 转换为响应模型
80
+ result = build_success_instance(response)
81
+ print(result.status)
82
+ print(result.Data)
83
+ ```
84
+
85
+ ### SCMP 模块
86
+
87
+ ```python
88
+ from py_tiehu_toolkit.scmp import Scmp
89
+ from py_tiehu_toolkit.scmp.utils import build_success_instance
90
+
91
+ # 创建同步客户端
92
+ scmp = Scmp(
93
+ base_url="https://scmp.example.com",
94
+ appid="app001",
95
+ secret="your_secret"
96
+ )
97
+
98
+ # 发送请求
99
+ response = scmp.request_with_token(url="/api/v1/data")
100
+
101
+ # 转换为响应模型
102
+ result = build_success_instance(response)
103
+ print(result.code)
104
+ print(result.Data)
105
+ ```
106
+
107
+ ### 异步调用
108
+
109
+ ```python
110
+ import asyncio
111
+ from py_tiehu_toolkit.parking import Pklot
112
+
113
+ async def main():
114
+ pklot = Pklot(
115
+ base_url="https://isc.example.com",
116
+ parking_id="park001",
117
+ app_key="your_app_secret"
118
+ )
119
+
120
+ # 异步请求
121
+ response = await pklot.async_request_with_signature(url="/api/v1/query")
122
+ print(response.json())
123
+
124
+ asyncio.run(main())
125
+ ```
126
+
127
+ ## API 参考
128
+
129
+ ### parking.Pklot 类
130
+
131
+ | 方法 | 说明 |
132
+ |------|------|
133
+ | `__init__(base_url, parking_id, app_key, client_kwargs)` | 初始化客户端 |
134
+ | `signature(data)` | 生成请求签名 |
135
+ | `request_with_signature(client, client_kwargs, **kwargs)` | 同步请求(带签名) |
136
+ | `async_request_with_signature(client, client_kwargs, **kwargs)` | 异步请求(带签名) |
137
+
138
+ ### scmp.Scmp 类
139
+
140
+ | 方法 | 说明 |
141
+ |------|------|
142
+ | `__init__(base_url, appid, secret, client_kwargs)` | 初始化客户端 |
143
+ | `token(ts)` | 生成请求 Token |
144
+ | `request_with_token(client, client_kwargs, **kwargs)` | 同步请求(带 Token) |
145
+ | `async_request_with_token(client, client_kwargs, **kwargs)` | 异步请求(带 Token) |
146
+
147
+ ### utils 工具函数
148
+
149
+ | 函数 | 说明 |
150
+ |------|------|
151
+ | `timestamp()` | 生成毫秒级时间戳 |
152
+ | `json_find_first(expression, data)` | JSONPath 查询 |
153
+ | `json_is_valid(schema, data)` | JSON Schema 校验 |
154
+ | `build_success_instance(response)` | 响应转模型 |
155
+ | `success_is_valid(response, schema)` | 校验成功响应 |
156
+
157
+
158
+ ## 作者
159
+
160
+ **Guolei** - <174000902@qq.com>
161
+
162
+ ## 项目主页
163
+
164
+ - **仓库**: https://gitee.com/guolei19850528/py_tiehu_toolkit
165
+ - **官方文档**: https://www.showdoc.com.cn/1735808258920310/9467753400037587
166
+
167
+ ## 许可证
168
+
169
+ MIT License
@@ -0,0 +1,58 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "py-tiehu-toolkit"
7
+ version = "1.0.0"
8
+ requires-python = ">=3.10"
9
+ authors = [
10
+ { name = "Guolei", email = "174000902@qq.com" }
11
+ ]
12
+ description = "py-tiehu 是铁虎管理系统的 Python SDK,提供同步和异步两种调用方式,实现完整的请求签名机制,用于与铁虎停车场管理系统(Parking)和 SCMP 进行 API 交互。"
13
+ keywords = ["tiehu", "python", "client", "api", "铁虎", "parking", "scmp"]
14
+ license = { file = "LICENSE" }
15
+ readme = "README.md"
16
+ classifiers = [
17
+ "License :: OSI Approved :: MIT License",
18
+ "Development Status :: 4 - Beta",
19
+ "Intended Audience :: Developers",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Operating System :: OS Independent",
26
+ "Topic :: Software Development :: Libraries :: Python Modules",
27
+ "Topic :: Internet :: WWW/HTTP",
28
+ "Topic :: Internet :: WWW/HTTP :: Session",
29
+ "Typing :: Typed",
30
+ ]
31
+ dependencies = [
32
+ "httpx>=0.27.0",
33
+ "pydantic>=2.0",
34
+ "jsonpath-ng>=1.5.3",
35
+ "jsonschema>=4.21.0",
36
+ "py-httpx-toolkit>=1.0.1",
37
+ ]
38
+
39
+ [project.optional-dependencies]
40
+ dev = [
41
+ "pytest>=7.0",
42
+ "pytest-cov>=4.0",
43
+ "pytest-asyncio>=0.21.0",
44
+ "setuptools>=61.0",
45
+ "twine>=4.0",
46
+ "black>=23.0",
47
+ "isort>=5.12.0",
48
+ "flake8>=6.0",
49
+ "mypy>=1.0",
50
+ ]
51
+
52
+ [project.urls]
53
+ "Homepage" = "https://gitee.com/guolei19850528/py_tiehu_toolkit"
54
+ "Repository" = "https://gitee.com/guolei19850528/py_tiehu_toolkit.git"
55
+ "Documentation" = "https://www.showdoc.com.cn/1735808258920310/9467753400037587"
56
+
57
+ [tool.setuptools.packages.find]
58
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: UTF-8 -*-
3
+ """
4
+ py-tiehu - 铁虎管理系统 API Python SDK
5
+
6
+ 提供同步和异步两种调用方式,实现完整的请求签名机制,
7
+ 用于与铁虎停车场管理系统(Parking)和 SCMP 进行 API 交互。
8
+
9
+ 官方文档: https://www.showdoc.com.cn/1735808258920310/9467753400037587
10
+
11
+ 项目结构:
12
+ - py_tiehu.parking: 停车场模块,用于与铁虎停车场管理系统交互
13
+ - Pklot: 停车场 API 客户端类
14
+ - utils: 工具函数(timestamp, json_find_first, build_success_instance 等)
15
+ - responses: 响应数据模型(Base, Success)
16
+ - py_tiehu.scmp: SCMP 模块,用于与铁虎管理系统交互
17
+ - Scmp: SCMP API 客户端类
18
+ - utils: 工具函数(timestamp, json_find_first, build_success_instance 等)
19
+ - responses: 响应数据模型(Base, Success)
20
+
21
+ 使用方式:
22
+ # 导入停车场模块
23
+ from py_tiehu.parking import Pklot
24
+ from py_tiehu.parking.utils import build_success_instance, timestamp
25
+
26
+ # 导入 SCMP 模块
27
+ from py_tiehu.scmp import Scmp
28
+ from py_tiehu.scmp.utils import build_success_instance
29
+
30
+ 功能特性:
31
+ - 自动生成请求签名/Token(MD5 算法)
32
+ - 支持同步/异步 HTTP 请求
33
+ - 自动添加公共请求参数
34
+ - Pydantic 响应模型支持
35
+ - JSON Schema 响应校验
36
+ - JSONPath 数据查询
37
+
38
+ 许可证: MIT License
39
+ 作者: Guolei <174000902@qq.com>
40
+ 项目主页: https://gitee.com/guolei19850528/py_tiehu
41
+ """