py_wisharetec_toolkit 3.0.2__tar.gz → 3.0.3__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.
Files changed (15) hide show
  1. {py_wisharetec_toolkit-3.0.2 → py_wisharetec_toolkit-3.0.3}/PKG-INFO +29 -3
  2. {py_wisharetec_toolkit-3.0.2 → py_wisharetec_toolkit-3.0.3}/README.md +28 -2
  3. {py_wisharetec_toolkit-3.0.2 → py_wisharetec_toolkit-3.0.3}/pyproject.toml +1 -1
  4. {py_wisharetec_toolkit-3.0.2 → py_wisharetec_toolkit-3.0.3}/src/py_wisharetec_toolkit/__init__.py +1 -1
  5. {py_wisharetec_toolkit-3.0.2 → py_wisharetec_toolkit-3.0.3}/src/py_wisharetec_toolkit/shanshu/__init__.py +1 -1
  6. {py_wisharetec_toolkit-3.0.2 → py_wisharetec_toolkit-3.0.3}/src/py_wisharetec_toolkit/shanshu/auth.py +3 -3
  7. {py_wisharetec_toolkit-3.0.2 → py_wisharetec_toolkit-3.0.3}/src/py_wisharetec_toolkit/shanshu/client.py +2 -2
  8. {py_wisharetec_toolkit-3.0.2 → py_wisharetec_toolkit-3.0.3}/src/py_wisharetec_toolkit.egg-info/PKG-INFO +29 -3
  9. {py_wisharetec_toolkit-3.0.2 → py_wisharetec_toolkit-3.0.3}/setup.cfg +0 -0
  10. {py_wisharetec_toolkit-3.0.2 → py_wisharetec_toolkit-3.0.3}/src/py_wisharetec_toolkit/py.typed +0 -0
  11. {py_wisharetec_toolkit-3.0.2 → py_wisharetec_toolkit-3.0.3}/src/py_wisharetec_toolkit/shanshu/models.py +0 -0
  12. {py_wisharetec_toolkit-3.0.2 → py_wisharetec_toolkit-3.0.3}/src/py_wisharetec_toolkit.egg-info/SOURCES.txt +0 -0
  13. {py_wisharetec_toolkit-3.0.2 → py_wisharetec_toolkit-3.0.3}/src/py_wisharetec_toolkit.egg-info/dependency_links.txt +0 -0
  14. {py_wisharetec_toolkit-3.0.2 → py_wisharetec_toolkit-3.0.3}/src/py_wisharetec_toolkit.egg-info/requires.txt +0 -0
  15. {py_wisharetec_toolkit-3.0.2 → py_wisharetec_toolkit-3.0.3}/src/py_wisharetec_toolkit.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py_wisharetec_toolkit
3
- Version: 3.0.2
3
+ Version: 3.0.3
4
4
  Summary: 浙江慧享科技有限公司 - 善数・慧享云运营平台 Python 扩展包,提供接口调用封装
5
5
  Author-email: guolei <174000902@qq.com>
6
6
  License: MIT
@@ -243,10 +243,29 @@ asyncio.run(main())
243
243
  ### 接口注意事项
244
244
 
245
245
  - 园区、房产、楼幢、车场、业主、车辆、车位、审批等接口的 `conditions` 需携带 `spaceTreeId` 与 `flag`。
246
- - 住户档案接口需传入空条件:`conditions={}`。
246
+ - 住户档案接口需传入空条件:`conditions={}`;商城订单、服务订单接口需传入 `conditions={"fields": []}`(不能携带 `spaceTreeId`、`flag`,否则后端返回“系统内部报错”)。
247
247
  - 工单档案接口要求 `conditions` 中额外携带 `appCode=WORK_ORDER`。
248
248
  - 审批详情需先通过审批列表接口获取 `procInstId`,节点 ID 固定为 `node_433279443693`;业主详情需先获取 `userId` / `communityId` / `spaceId`,再调用详情接口。
249
249
 
250
+ ## 示例代码
251
+
252
+ 完整可运行示例位于 `examples/shanshu/`,覆盖全部接口的同步与异步调用,命名规则为 `example_*.py`(同步)与 `example_async_*.py`(异步)。
253
+
254
+ 1. 复制模板并填写真实账号:
255
+
256
+ ```bash
257
+ cp examples/shanshu/.env.example examples/shanshu/.env
258
+ ```
259
+
260
+ 2. 运行示例(以园区档案为例):
261
+
262
+ ```bash
263
+ python examples/shanshu/example_community_page.py
264
+ python examples/shanshu/example_async_community_page.py
265
+ ```
266
+
267
+ 公共配置与查询条件集中在 `examples/shanshu/example_common.py`,统一从 `examples/shanshu/.env` 读取 `SHANSHU_*` 变量。
268
+
250
269
  ## 运行测试
251
270
 
252
271
  测试用例位于 `tests/shanshu/`,基于 pytest + pytest-asyncio,统一从 `tests/shanshu/.env` 读取配置,公共夹具定义在 `tests/shanshu/conftest.py`。
@@ -274,7 +293,7 @@ pytest tests/shanshu -q
274
293
  - `ShanshuDiskCacheTokenCache`:基于 diskcache 的持久化缓存(需安装 `[cache]` 依赖)
275
294
  - `ShanshuRedisTokenCache`:基于 redis 的缓存(需安装 `[cache]` 依赖)
276
295
 
277
- 缓存 key 格式:`py_wisharetec_toolkit:shanshu:authorization_token:{account}`,便于缓存不同用户的登录 token。
296
+ 缓存 key 格式:`py_wisharetec_toolkit:shanshu:authorization:{account}`,便于缓存不同用户的登录 token。
278
297
 
279
298
  ## 目录结构
280
299
 
@@ -293,6 +312,13 @@ tests/
293
312
  ├── conftest.py # 公共夹具(客户端、登录、查询条件)
294
313
  ├── .env.example # 测试配置模板
295
314
  └── test_*.py # 各接口的同步 / 异步测试用例
315
+
316
+ examples/
317
+ └── shanshu/
318
+ ├── example_common.py # 示例公共辅助(读取配置、构造客户端、查询条件)
319
+ ├── .env.example # 示例配置模板
320
+ ├── example_*.py # 各接口同步示例
321
+ └── example_async_*.py # 各接口异步示例
296
322
  ```
297
323
 
298
324
  ## 参数说明
@@ -210,10 +210,29 @@ asyncio.run(main())
210
210
  ### 接口注意事项
211
211
 
212
212
  - 园区、房产、楼幢、车场、业主、车辆、车位、审批等接口的 `conditions` 需携带 `spaceTreeId` 与 `flag`。
213
- - 住户档案接口需传入空条件:`conditions={}`。
213
+ - 住户档案接口需传入空条件:`conditions={}`;商城订单、服务订单接口需传入 `conditions={"fields": []}`(不能携带 `spaceTreeId`、`flag`,否则后端返回“系统内部报错”)。
214
214
  - 工单档案接口要求 `conditions` 中额外携带 `appCode=WORK_ORDER`。
215
215
  - 审批详情需先通过审批列表接口获取 `procInstId`,节点 ID 固定为 `node_433279443693`;业主详情需先获取 `userId` / `communityId` / `spaceId`,再调用详情接口。
216
216
 
217
+ ## 示例代码
218
+
219
+ 完整可运行示例位于 `examples/shanshu/`,覆盖全部接口的同步与异步调用,命名规则为 `example_*.py`(同步)与 `example_async_*.py`(异步)。
220
+
221
+ 1. 复制模板并填写真实账号:
222
+
223
+ ```bash
224
+ cp examples/shanshu/.env.example examples/shanshu/.env
225
+ ```
226
+
227
+ 2. 运行示例(以园区档案为例):
228
+
229
+ ```bash
230
+ python examples/shanshu/example_community_page.py
231
+ python examples/shanshu/example_async_community_page.py
232
+ ```
233
+
234
+ 公共配置与查询条件集中在 `examples/shanshu/example_common.py`,统一从 `examples/shanshu/.env` 读取 `SHANSHU_*` 变量。
235
+
217
236
  ## 运行测试
218
237
 
219
238
  测试用例位于 `tests/shanshu/`,基于 pytest + pytest-asyncio,统一从 `tests/shanshu/.env` 读取配置,公共夹具定义在 `tests/shanshu/conftest.py`。
@@ -241,7 +260,7 @@ pytest tests/shanshu -q
241
260
  - `ShanshuDiskCacheTokenCache`:基于 diskcache 的持久化缓存(需安装 `[cache]` 依赖)
242
261
  - `ShanshuRedisTokenCache`:基于 redis 的缓存(需安装 `[cache]` 依赖)
243
262
 
244
- 缓存 key 格式:`py_wisharetec_toolkit:shanshu:authorization_token:{account}`,便于缓存不同用户的登录 token。
263
+ 缓存 key 格式:`py_wisharetec_toolkit:shanshu:authorization:{account}`,便于缓存不同用户的登录 token。
245
264
 
246
265
  ## 目录结构
247
266
 
@@ -260,6 +279,13 @@ tests/
260
279
  ├── conftest.py # 公共夹具(客户端、登录、查询条件)
261
280
  ├── .env.example # 测试配置模板
262
281
  └── test_*.py # 各接口的同步 / 异步测试用例
282
+
283
+ examples/
284
+ └── shanshu/
285
+ ├── example_common.py # 示例公共辅助(读取配置、构造客户端、查询条件)
286
+ ├── .env.example # 示例配置模板
287
+ ├── example_*.py # 各接口同步示例
288
+ └── example_async_*.py # 各接口异步示例
263
289
  ```
264
290
 
265
291
  ## 参数说明
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "py_wisharetec_toolkit"
7
- version = "3.0.2"
7
+ version = "3.0.3"
8
8
  description = "浙江慧享科技有限公司 - 善数・慧享云运营平台 Python 扩展包,提供接口调用封装"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -5,7 +5,7 @@
5
5
  可供他人通过 `import py_wisharetec_toolkit` 导入。
6
6
  """
7
7
 
8
- __version__ = "3.0.2"
8
+ __version__ = "3.0.3"
9
9
  __all__ = ["shanshu"]
10
10
 
11
11
  from . import shanshu # noqa: E402
@@ -7,7 +7,7 @@
7
7
  `from py_wisharetec_toolkit.shanshu import client, models, auth` 导入。
8
8
  """
9
9
 
10
- __version__ = "3.0.2"
10
+ __version__ = "3.0.3"
11
11
  __all__ = ["client", "models", "auth"]
12
12
 
13
13
  from . import client # noqa: E402
@@ -6,7 +6,7 @@
6
6
  提供基于 httpx 的 ``/api/user/loginInteractive`` 接口调用,
7
7
  并支持 memory / diskcache / redis 三种 Token 缓存后端。
8
8
 
9
- 缓存 key 格式:py_wisharetec_toolkit:shanshu:authorization_token:{account}
9
+ 缓存 key 格式:py_wisharetec_toolkit:shanshu:authorization:{account}
10
10
  便于缓存不同用户的登录 token。
11
11
  """
12
12
 
@@ -17,13 +17,13 @@ import threading
17
17
  from typing import Any, Protocol, runtime_checkable
18
18
 
19
19
  LOGIN_PATH = "api/user/loginInteractive"
20
- CACHE_KEY_PREFIX = "py_wisharetec_toolkit:shanshu:authorization_token"
20
+ CACHE_KEY_PREFIX = "py_wisharetec_toolkit:shanshu:authorization"
21
21
 
22
22
 
23
23
  def cache_key(account: str) -> str:
24
24
  """构造 Token 缓存 key。
25
25
 
26
- 格式:py_wisharetec_toolkit:shanshu:authorization_token:{account}
26
+ 格式:py_wisharetec_toolkit:shanshu:authorization:{account}
27
27
  """
28
28
  return f"{CACHE_KEY_PREFIX}:{account}"
29
29
 
@@ -219,7 +219,7 @@ class ShanshuClient:
219
219
  - 请求头固定携带 ``client=co-pc``。
220
220
  - 返回体若不包含 ``code`` 字段,视为登录成功。
221
221
  - 成功后从响应 headers 中提取 ``authorization`` 值,按
222
- ``py_wisharetec_toolkit:shanshu:authorization_token:{account}`` 缓存。
222
+ ``py_wisharetec_toolkit:shanshu:authorization:{account}`` 缓存。
223
223
  """
224
224
  cache = token_cache or self._token_cache
225
225
  key = cache_key(account)
@@ -1301,7 +1301,7 @@ class AsyncShanshuClient:
1301
1301
  - 请求头固定携带 ``client=co-pc``。
1302
1302
  - 返回体若不包含 ``code`` 字段,视为登录成功。
1303
1303
  - 成功后从响应 headers 中提取 ``authorization`` 值,按
1304
- ``py_wisharetec_toolkit:shanshu:authorization_token:{account}`` 缓存。
1304
+ ``py_wisharetec_toolkit:shanshu:authorization:{account}`` 缓存。
1305
1305
  """
1306
1306
  cache = token_cache or self._token_cache
1307
1307
  key = cache_key(account)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py_wisharetec_toolkit
3
- Version: 3.0.2
3
+ Version: 3.0.3
4
4
  Summary: 浙江慧享科技有限公司 - 善数・慧享云运营平台 Python 扩展包,提供接口调用封装
5
5
  Author-email: guolei <174000902@qq.com>
6
6
  License: MIT
@@ -243,10 +243,29 @@ asyncio.run(main())
243
243
  ### 接口注意事项
244
244
 
245
245
  - 园区、房产、楼幢、车场、业主、车辆、车位、审批等接口的 `conditions` 需携带 `spaceTreeId` 与 `flag`。
246
- - 住户档案接口需传入空条件:`conditions={}`。
246
+ - 住户档案接口需传入空条件:`conditions={}`;商城订单、服务订单接口需传入 `conditions={"fields": []}`(不能携带 `spaceTreeId`、`flag`,否则后端返回“系统内部报错”)。
247
247
  - 工单档案接口要求 `conditions` 中额外携带 `appCode=WORK_ORDER`。
248
248
  - 审批详情需先通过审批列表接口获取 `procInstId`,节点 ID 固定为 `node_433279443693`;业主详情需先获取 `userId` / `communityId` / `spaceId`,再调用详情接口。
249
249
 
250
+ ## 示例代码
251
+
252
+ 完整可运行示例位于 `examples/shanshu/`,覆盖全部接口的同步与异步调用,命名规则为 `example_*.py`(同步)与 `example_async_*.py`(异步)。
253
+
254
+ 1. 复制模板并填写真实账号:
255
+
256
+ ```bash
257
+ cp examples/shanshu/.env.example examples/shanshu/.env
258
+ ```
259
+
260
+ 2. 运行示例(以园区档案为例):
261
+
262
+ ```bash
263
+ python examples/shanshu/example_community_page.py
264
+ python examples/shanshu/example_async_community_page.py
265
+ ```
266
+
267
+ 公共配置与查询条件集中在 `examples/shanshu/example_common.py`,统一从 `examples/shanshu/.env` 读取 `SHANSHU_*` 变量。
268
+
250
269
  ## 运行测试
251
270
 
252
271
  测试用例位于 `tests/shanshu/`,基于 pytest + pytest-asyncio,统一从 `tests/shanshu/.env` 读取配置,公共夹具定义在 `tests/shanshu/conftest.py`。
@@ -274,7 +293,7 @@ pytest tests/shanshu -q
274
293
  - `ShanshuDiskCacheTokenCache`:基于 diskcache 的持久化缓存(需安装 `[cache]` 依赖)
275
294
  - `ShanshuRedisTokenCache`:基于 redis 的缓存(需安装 `[cache]` 依赖)
276
295
 
277
- 缓存 key 格式:`py_wisharetec_toolkit:shanshu:authorization_token:{account}`,便于缓存不同用户的登录 token。
296
+ 缓存 key 格式:`py_wisharetec_toolkit:shanshu:authorization:{account}`,便于缓存不同用户的登录 token。
278
297
 
279
298
  ## 目录结构
280
299
 
@@ -293,6 +312,13 @@ tests/
293
312
  ├── conftest.py # 公共夹具(客户端、登录、查询条件)
294
313
  ├── .env.example # 测试配置模板
295
314
  └── test_*.py # 各接口的同步 / 异步测试用例
315
+
316
+ examples/
317
+ └── shanshu/
318
+ ├── example_common.py # 示例公共辅助(读取配置、构造客户端、查询条件)
319
+ ├── .env.example # 示例配置模板
320
+ ├── example_*.py # 各接口同步示例
321
+ └── example_async_*.py # 各接口异步示例
296
322
  ```
297
323
 
298
324
  ## 参数说明