pytest-api-framework-alpha 1.0.5__py3-none-any.whl

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 (48) hide show
  1. framework/__init__.py +1 -0
  2. framework/assertion/__init__.py +3 -0
  3. framework/assertion/retry_assert.py +67 -0
  4. framework/assertion/webhook_assert.py +129 -0
  5. framework/client/__init__.py +3 -0
  6. framework/client/crrm_client.py +155 -0
  7. framework/client/http_client.py +340 -0
  8. framework/client/mq_client.py +178 -0
  9. framework/client/websocket_client.py +414 -0
  10. framework/conftest.py +526 -0
  11. framework/core/__init__.py +3 -0
  12. framework/core/base_class.py +871 -0
  13. framework/core/extract.py +185 -0
  14. framework/core/global_attribute.py +187 -0
  15. framework/core/hooks/__init__.py +3 -0
  16. framework/core/hooks/filters.py +217 -0
  17. framework/core/hooks/reporter.py +228 -0
  18. framework/core/hooks/session.py +345 -0
  19. framework/core/hooks/sorting.py +84 -0
  20. framework/core/models.py +82 -0
  21. framework/core/render_data.py +309 -0
  22. framework/core/validate.py +648 -0
  23. framework/db/__init__.py +3 -0
  24. framework/db/mysql_db.py +226 -0
  25. framework/db/redis_db.py +319 -0
  26. framework/exceptions.py +22 -0
  27. framework/exit_code.py +20 -0
  28. framework/gen/__init__.py +3 -0
  29. framework/gen/case_gen.py +1268 -0
  30. framework/gen/create_app.py +265 -0
  31. framework/report.py +111 -0
  32. framework/script.py +35 -0
  33. framework/settings.py +93 -0
  34. framework/utils/__init__.py +3 -0
  35. framework/utils/cognito_util.py +348 -0
  36. framework/utils/common.py +298 -0
  37. framework/utils/date_util.py +218 -0
  38. framework/utils/encrypt.py +448 -0
  39. framework/utils/lark_util.py +167 -0
  40. framework/utils/log_util.py +10 -0
  41. framework/utils/mock_util.py +236 -0
  42. framework/utils/yaml_util.py +169 -0
  43. framework/ws_server.py +167 -0
  44. pytest_api_framework_alpha-1.0.5.dist-info/METADATA +98 -0
  45. pytest_api_framework_alpha-1.0.5.dist-info/RECORD +48 -0
  46. pytest_api_framework_alpha-1.0.5.dist-info/WHEEL +5 -0
  47. pytest_api_framework_alpha-1.0.5.dist-info/licenses/LICENSE +21 -0
  48. pytest_api_framework_alpha-1.0.5.dist-info/top_level.txt +1 -0
@@ -0,0 +1,265 @@
1
+ """新应用脚手架生成模块,为新的测试应用创建 YAML 配置、测试用例、测试数据和会话配置。"""
2
+
3
+ import os
4
+ import argparse
5
+ from pathlib import Path
6
+
7
+ import yaml
8
+ from framework.utils.common import snake_to_pascal
9
+ from framework.settings import CONFIG_DIR, CASES_DIR, DATA_DIR
10
+
11
+
12
+ def create_yaml(app, env):
13
+ """
14
+ 为指定应用创建 YAML 配置文件(context.{env}.yaml),包含环境域名和账号信息。
15
+
16
+ 环境体现在文件名上,文件内部不再有顶层环境层级(见 framework/conftest.py 的 load_app_context)。
17
+
18
+ @param app: str, 应用名称
19
+ @param env: str, 环境名称
20
+ """
21
+ os.makedirs(os.path.join(CONFIG_DIR, app), exist_ok=True)
22
+ with open(os.path.join(CONFIG_DIR, app, f"context.{env}.yaml"), 'w', encoding="utf-8") as f:
23
+ yaml.dump({
24
+ "token_expiry": 280,
25
+ "domain": f"https://{env}.example.com",
26
+ "wss": f"wss://{env}.example.com",
27
+ "accounts": {
28
+ "admin": {
29
+ "username": "admin",
30
+ "password": "test"
31
+ }
32
+ }
33
+ }, f, default_flow_style=False, allow_unicode=True, sort_keys=False)
34
+ # with open(os.path.join(CONFIG_DIR, app, "config.yaml"), 'w', encoding="utf-8") as f:
35
+ # yaml.dump({
36
+ # "dev": {
37
+ # "mysql": {
38
+ # "host": None,
39
+ # "username": None,
40
+ # "password": None,
41
+ # "port": 3306
42
+ # },
43
+ # "redis": {
44
+ # "host": None,
45
+ # "password": None,
46
+ # "port": 6379
47
+ # },
48
+ # "mq": {
49
+ # "host": None,
50
+ # "port": 5672,
51
+ # "credentials": {
52
+ # "username": "guest",
53
+ # "password": "guest"
54
+ # },
55
+ # "virtual_hosts": {
56
+ # "/": {
57
+ # # "credentials": { #
58
+ # # "username": "guest",
59
+ # # "password": "guest"
60
+ # # },
61
+ # "exchanges": {
62
+ # "logs_topic": {
63
+ # "type": "topic",
64
+ # "durable": false
65
+ # }
66
+ # }
67
+ # }
68
+ # }
69
+ # }
70
+ #
71
+ # }
72
+ # }, f, default_flow_style=False, allow_unicode=True, sort_keys=False)
73
+
74
+
75
+ def create_test_case(app: str):
76
+ """
77
+ 为指定应用创建 Python 测试用例文件(test_untitled.py)和 __init__.py。
78
+
79
+ @param app: str, 应用名称
80
+ """
81
+ os.makedirs(os.path.join(CASES_DIR, app), exist_ok=True)
82
+ init_file = Path(os.path.join(CASES_DIR, app)) / "__init__.py"
83
+ init_file.touch(exist_ok=True)
84
+ content = f"""
85
+ from test_case import BaseTestCase
86
+
87
+
88
+ class TestUntitled(BaseTestCase):
89
+
90
+ def test_untitled(self):
91
+ # 发送请求
92
+ self.request(account="admin")
93
+ # 断言
94
+ assert self.response.status_code == 200
95
+ assert len(self.response.jsonpath("$.data.balances")) > 0
96
+
97
+ def test_socket_untitled(self):
98
+ # 发送消息,匹配返回消息内容中value<100的消息
99
+ # self.websocket(account="admin", matcher=lambda message: message.get("value") < 100)
100
+ # print(self.response)
101
+
102
+ # 发送消息,自定义返回消息匹配规则
103
+ # for message in self.subscribe(account="admin"):
104
+ # if message.get("value") < 100:
105
+ # print(message)
106
+ # break
107
+
108
+ # 断言
109
+ assert self.response.status_code == 200
110
+ assert len(self.response.jsonpath("$.data.balances")) > 0"""
111
+ with open(os.path.join(CASES_DIR, app, "test_untitled.py"), 'w', encoding="utf-8") as file:
112
+ file.write(content)
113
+
114
+
115
+ def create_test_data(app):
116
+ """
117
+ 为指定应用创建 YAML 测试数据文件(test_untitled.yaml)。
118
+
119
+ 测试数据不分环境,直接放在 test_data/{app}/ 下,和 test_case/{app}/ 保持一一对应。
120
+
121
+ @param app: str, 应用名称
122
+ """
123
+ os.makedirs(os.path.join(DATA_DIR, app), exist_ok=True)
124
+
125
+ with open(os.path.join(DATA_DIR, app, "test_untitled.yaml"), 'w', encoding="utf-8") as f:
126
+ yaml.dump({
127
+ "case_common": {
128
+ "module": "功能模块名称",
129
+ "describe": "测试场景描述",
130
+ "ignore_failed": False, # 默认false,遇到失败case会忽略当前类中后续case,直接执行下个测试类
131
+ "scenarios": [
132
+ {
133
+ "scenario": {
134
+ "data": {
135
+ "tag_id": 1,
136
+ "user_id": 1
137
+ },
138
+ "exclude": [
139
+ "test_untitled"
140
+ ]
141
+ }
142
+ }
143
+ ]
144
+ },
145
+ "test_untitled": {
146
+ "title": "登录成功",
147
+ "level": "p0",
148
+ "request": {
149
+ "url": "/login",
150
+ "method": "post",
151
+ "json": {
152
+ "username": "Jerry",
153
+ "password": "${user_id}"
154
+ }
155
+ },
156
+ "validate": [
157
+ {
158
+ "eq": "status_code, 200"
159
+ },
160
+ {
161
+ "eq": "$.code, 200"
162
+ },
163
+ {
164
+ "not_null": "$.data"
165
+ }
166
+ ],
167
+ "extract": [
168
+ {
169
+ "id": "$.data.token"
170
+ }
171
+ ]
172
+ },
173
+ "test_socket_untitled": {
174
+ "title": "test_socket222",
175
+ "level": "p0",
176
+ "request": {
177
+ "url": "/ws/query-token",
178
+ "message": {
179
+ "name": "${name()}",
180
+ "password": "${user_id}"
181
+ }
182
+ },
183
+ "validate": [
184
+ {
185
+ "eq": "status_code, 200"
186
+ },
187
+ {
188
+ "eq": "$.code, 200"
189
+ },
190
+ {
191
+ "not_null": "$.data"
192
+ }
193
+ ],
194
+ "extract": [
195
+ {
196
+ "id": "$.data.token"
197
+ }
198
+ ]
199
+ }
200
+ }, f, default_flow_style=False, allow_unicode=True, sort_keys=False)
201
+
202
+
203
+ def create_app_session(app):
204
+ """
205
+ 向 conftest.py 追加应用的 HTTP 和 WebSocket 登录配置。
206
+
207
+ @param app: str, 应用名称
208
+ """
209
+ content = f"""
210
+
211
+ class {snake_to_pascal(app)}Login(HttpLogin):
212
+
213
+ def login(self, username, password, **kwargs):
214
+ client = HttpClient()
215
+ # TODO 需要实现登录逻辑,将登录获取到的token添加到headers中
216
+ response = client.post()
217
+ token = response.jsonpath("$.data.token")
218
+
219
+ if token:
220
+ client.update_headers({{"token": token}})
221
+ return client
222
+ raise LoginException(response)
223
+
224
+ class {snake_to_pascal(app)}WsLogin(WsLogin):
225
+
226
+ def login(self, username, password, url=None, **kwargs):
227
+ # TODO 实现登录并返回已鉴权的 WebsocketClient
228
+ websocket = WebsocketClient(url, headers={{"Authorization": "Bearer my-secret-token"}})
229
+ websocket.wait_message(timeout=5)
230
+ if websocket.is_alive:
231
+ return websocket
232
+ raise LoginException(\"鉴权失败\")"""
233
+ with open(os.path.join(CASES_DIR, "conftest.py"), "a", encoding="utf-8") as f:
234
+ f.write(content)
235
+
236
+
237
+ def process_command_line_args():
238
+ """
239
+ 解析命令行参数(应用名和环境名)。
240
+
241
+ @return: argparse.Namespace
242
+ """
243
+ parser = argparse.ArgumentParser(description='startapp')
244
+ parser.add_argument('--app', '-a', required=True, type=str, help='应用名')
245
+ parser.add_argument('--env', '-e', required=True, type=str, help='环境')
246
+ return parser.parse_args()
247
+
248
+
249
+ def main():
250
+ """入口函数:创建新应用的完整脚手架(配置、用例、数据、会话)。"""
251
+ args = process_command_line_args()
252
+ app = args.app
253
+ env = args.env
254
+ if not os.path.exists(os.path.join(CONFIG_DIR, app)):
255
+ create_yaml(app, env)
256
+ create_test_case(app)
257
+ create_test_data(app)
258
+ create_app_session(app)
259
+ print(f"app {app}创建成功")
260
+ else:
261
+ print(f"app {app}已存在,未执行创建")
262
+
263
+
264
+ if __name__ == '__main__':
265
+ main()
framework/report.py ADDED
@@ -0,0 +1,111 @@
1
+ """
2
+ Allure 测试结果解析与上报脚本。
3
+
4
+ 将 Allure 生成的 result.json 文件解析后,将测试用例结果写入 MySQL 数据库,
5
+ 关联到对应的测试任务记录中。
6
+
7
+ 使用方式(命令行):
8
+ python report.py --task <任务名称> --buildnum <构建次数> --allure_result <result目录路径>
9
+ """
10
+ import json
11
+ import argparse
12
+ import datetime
13
+ import traceback
14
+ from pathlib import Path
15
+ from framework.db.mysql_db import MysqlDB
16
+ from framework.utils.log_util import logger
17
+
18
+ from framework.settings import DATABASE_HOST, DATABASE_PASSWORD, DATABASE_DB, DATABASE_USERNAME, DATABASE_PORT
19
+
20
+ if __name__ == '__main__':
21
+ logger.info('调用report脚本')
22
+ # 创建 ArgumentParser 对象,用于解析命令行参数
23
+ parser = argparse.ArgumentParser(description="演示如何使用 argparse 获取命令行参数")
24
+ # 添加任务名称参数(必填)
25
+ parser.add_argument('--task', help="输入任务的名字", required=True)
26
+ # 添加构建次数参数(必填)
27
+ parser.add_argument('--buildnum', type=int, help="输入构建次数", required=True)
28
+ # 添加 Allure 结果目录路径参数(必填)
29
+ parser.add_argument('--allure_result', type=str, help="allure_result路径", required=True)
30
+
31
+ # 解析命令行参数
32
+ args = parser.parse_args()
33
+ # 校验 task 参数是否提供,缺失则退出并返回状态码 400
34
+ if not args.task:
35
+ exit(400)
36
+ logger.info(f"task, {args.task}!")
37
+ taskName = args.task
38
+
39
+ # 校验 buildnum 参数是否提供
40
+ if not args.buildnum:
41
+ exit(400)
42
+ logger.info(f"buildnum, {args.buildnum}!")
43
+ buildNum = args.buildnum
44
+
45
+ # 校验 allure_result 参数是否提供
46
+ if not args.allure_result:
47
+ exit(400)
48
+ logger.info(f"allure_result_path, {args.allure_result}!")
49
+ allure_result_path = args.allure_result
50
+
51
+ # 初始化数据库连接
52
+ logger.info('初始化数据库连接')
53
+ mysqlDB = MysqlDB(
54
+ host=DATABASE_HOST,
55
+ username=DATABASE_USERNAME,
56
+ password=DATABASE_PASSWORD,
57
+ port=DATABASE_PORT,
58
+ db=DATABASE_DB
59
+ )
60
+
61
+ # 插入任务记录,获取 task_id
62
+ current_time = datetime.datetime.now()
63
+ formatted_time = current_time.strftime('%Y-%m-%d %H:%M:%S')
64
+ task_id = mysqlDB.insert(
65
+ f"INSERT INTO tbl_task (name,last_run_time,buildnum) VALUES ('{taskName}','{formatted_time}','{buildNum}')")
66
+ logger.info(f'{task_id}')
67
+
68
+ # 递归获取 allure_result 目录下所有以 'result.json' 结尾的文件
69
+ logger.info('获取所有*result.json结尾的文件')
70
+ folder = Path(allure_result_path)
71
+ all = list(folder.rglob('*result.json'))
72
+ logger.info(f'files count: {len(all)}')
73
+
74
+ # 遍历每个 result.json 文件,解析内容并写入数据库
75
+ for file_path in all:
76
+ try:
77
+ # 打开并解析 JSON 文件
78
+ with open(file_path, 'r', encoding='utf-8') as file:
79
+ data = json.load(file)
80
+ # 打印各字段到日志,便于调试
81
+ if 'fullName' in data:
82
+ logger.info(f"fullName: {data['fullName']}")
83
+ if 'testCaseId' in data:
84
+ logger.info(f"testCaseId: {data['testCaseId']}")
85
+ if 'start' in data:
86
+ logger.info(f"start: {data['start']}")
87
+ if 'stop' in data:
88
+ logger.info(f"stop: {data['stop']}")
89
+ if 'uuid' in data:
90
+ logger.info(f"uuid: {data['uuid']}")
91
+ if 'status' in data:
92
+ logger.info(f"status: {data['status']}")
93
+
94
+ if 'name' in data:
95
+ logger.info(f"name: {data['name']}")
96
+
97
+ # 将用例数据插入数据库,如果有错误详情则一并插入
98
+ if 'statusDetails' in data and data['statusDetails'] is not None:
99
+ mysqlDB.execute(
100
+ f"INSERT INTO tbl_test_case (test_case_id,status,name,starttime,stoptime,uuid,task_id,message) VALUES ('{data['testCaseId']}','{data['status']}','{data['name']}',{data['start']},{data['stop']},'{data['uuid']}',{task_id},'{str(data['statusDetails'])}')")
101
+ else:
102
+ mysqlDB.execute(
103
+ f"INSERT INTO tbl_test_case (test_case_id,status,name,starttime,stoptime,uuid,task_id) VALUES ('{data['testCaseId']}','{data['status']}','{data['name']}',{data['start']},{data['stop']},'{data['uuid']}',{task_id})")
104
+
105
+ except FileNotFoundError:
106
+ logger.info("错误: 文件未找到,请检查文件路径是否正确。")
107
+ except json.JSONDecodeError:
108
+ logger.info("错误: JSON 解析出错,请检查文件内容格式是否正确。")
109
+ except Exception as e:
110
+ logger.info(f"发生未知错误: {e}")
111
+ traceback.print_exc()
framework/script.py ADDED
@@ -0,0 +1,35 @@
1
+ """
2
+ 脚本基类模块。
3
+
4
+ 提供非 pytest 场景下(如独立脚本、数据处理脚本)使用的测试基类,
5
+ 封装了上下文管理、配置访问等框架核心功能。
6
+ """
7
+ from typing import Any
8
+
9
+ from framework.core.base_class import BaseTestCase
10
+
11
+
12
+ class BaseScript(BaseTestCase):
13
+ """脚本基类,供非 pytest 模式的独立脚本继承使用。
14
+
15
+ 提供应用上下文读写、默认应用管理等基础能力,子类需实现 run 方法。
16
+
17
+ @param app: str,当前脚本所属的应用名称
18
+ """
19
+
20
+ app = None
21
+
22
+ def run(self) -> None:
23
+ """脚本入口方法,子类必须实现此方法定义脚本执行逻辑。
24
+
25
+ @raises NotImplementedError: 子类未实现时抛出
26
+ """
27
+ raise NotImplementedError
28
+
29
+ def default_app(self, app: str | None) -> str:
30
+ """获取默认应用名称,如果传入的 app 为 None 则使用类属性 self.app。
31
+
32
+ @param app: str 或 None,传入的应用名称
33
+ @return: str,最终确定的应用名称
34
+ """
35
+ return app or self.app
framework/settings.py ADDED
@@ -0,0 +1,93 @@
1
+ """
2
+ 框架全局配置模块。
3
+
4
+ 定义框架运行所需的所有默认配置项,包括路径、报告、数据库、缓存、通知等。
5
+ 在项目 config.settings 中定义同名变量可覆盖框架默认值,实现项目级自定义配置。
6
+ """
7
+ import os
8
+ import sys as _sys
9
+ from pathlib import Path
10
+
11
+ # ---- 框架默认配置 ----
12
+ # config.settings 中定义了 ROOT_DIR 则会覆盖此默认值
13
+ ROOT_DIR = (Path(__file__).parent.parent) # 项目根目录,默认当前工作目录
14
+
15
+ # ---- 路径配置 ----
16
+ ALLURE_RESULTS_DIR = os.path.join(ROOT_DIR, "allure_results") # Allure 测试结果输出目录
17
+ ALLURE_REPORT_DIR = os.path.join(ROOT_DIR, "allure_report") # Allure 报告生成目录
18
+ ALLURE_PLUGIN_PATH = None # Allure 插件路径,None 表示使用系统安装的 Allure
19
+ CASES_DIR = os.path.join(ROOT_DIR, "test_case") # 测试用例脚本存放目录
20
+ DATA_DIR = os.path.join(ROOT_DIR, "test_data") # 测试数据文件(YAML)存放目录
21
+ CONFIG_DIR = os.path.join(ROOT_DIR, "config") # 配置文件存放目录(context.context.dev.yaml、database.{env}.yaml)
22
+ FILE_DIR = os.path.join(DATA_DIR, "file") # 测试数据中引用的文件资源目录
23
+ YML_CACHE_DIR = os.path.join(ROOT_DIR, ".cache_yml") # YAML 文件解析缓存目录,加速重复加载
24
+
25
+ # ---- 报告配置 ----
26
+ AUTO_OPEN_REPORT = True # 测试结束后是否自动在浏览器中打开 Allure 报告
27
+
28
+ # ---- 数据/日志配置 ----
29
+ FAKER_LANGUAGE = "en_US" # Faker 生成测试假数据时的语言区域
30
+ CONSOLE_DETAILED_LOG = True # 是否在终端输出详细日志(含请求/响应详情)
31
+
32
+ # ---- 鉴权配置 ----
33
+ UNAUTHORIZED_CODE = [401] # HTTP 鉴权失败的状态码列表,用于自动重新登录的判断
34
+ TOKEN_EXPIRY_LEEWAY = 60 # 用登录响应里的 expires_in 算过期时间时预留的提前量(秒),避免卡在过期点上
35
+
36
+ # ---- 响应对象属性 ----
37
+ RESPONSE_ATTR = ["status_code", "url", "ok", "encoding"] # 默认注入到测试实例的 response 属性列表
38
+
39
+ # ---- 用例执行控制 ----
40
+ GLOBAL_IGNORE_FAILED = False # 同一类中前序用例失败时,是否继续执行后续用例(False=跳过后续)
41
+
42
+ # ---- 用例级别配置 ----
43
+ CASE_LEVEL_LIST = ["p0", "p1", "p2"] # 合法的用例级别(优先级)列表
44
+ DEFAULT_CASE_LEVEL = "p1" # 用例未指定级别时的默认级别
45
+
46
+ # ---- 用例运行模式 ----
47
+ ONLY_SUPPORT_SCENARIO = False # 是否强制仅支持 scenario 参数化模式(True=无 scenario 则报错退出)
48
+ STRICT_MARKS = False # 是否启用严格标签模式(True=使用非规范标签或级别时跳过/中断)
49
+
50
+ # ---- 异步断言配置 ----
51
+ ASYNC_ASSERT_TIMEOUT = 120 # 异步断言(eventually)的最大等待时间,单位秒
52
+ ASYNC_ASSERT_TRIES = 30 # 异步断言的重试间隔,单位秒(每30秒检查一次)
53
+
54
+ # ---- 数据库连接池配置 ----
55
+ MYSQL_MAX_CONNECTIONS = 3 # MySQL 连接池最大连接数
56
+ MYSQL_RETRIES = 3 # 创建 MySQL 连接池失败时的重试次数
57
+ MYSQL_DELAY = 2 # 创建 MySQL 连接池重试间隔,单位秒
58
+ REDIS_MAX_CONNECTIONS = 3 # Redis 连接池最大连接数
59
+ REDIS_RETRIES = 3 # 创建 Redis 连接失败时的重试次数
60
+ REDIS_DELAY = 2 # 创建 Redis 连接重试间隔,单位秒
61
+
62
+ # ---- WebSocket 配置 ----
63
+ WEBSOCKET_TIMEOUT = 600 # WebSocket 连接最大保持时间,单位秒
64
+
65
+ # ---- 处理器(Hook)配置 ----
66
+ GLOBAL_START_HANDLER_CLASSES = [] # 全局前置处理器类列表(所有用例执行前运行一次)
67
+ GLOBAL_FINISH_HANDLER_CLASSES = [] # 全局后置处理器类列表(所有用例执行后运行一次)
68
+ APP_START_HANDLER_CLASSES = {} # 按应用隔离的前置处理器,格式: {"app_name": [HandlerClass, ...]}
69
+ APP_FINISH_HANDLER_CLASSES = {} # 按应用隔离的后置处理器,格式: {"app_name": [HandlerClass, ...]}
70
+
71
+ # ---- 用例标签配置 ----
72
+ MARK_LIST = {} # 规范标签字典,格式: {"module": ["smoke", "regression"], ...},用于标签校验
73
+
74
+ # ---- Webhook 获取配置 ----
75
+ GET_WEBHOOK_TIMEOUT = 60 # 等待 Webhook 回调的最大时间,单位秒
76
+ GET_WEBHOOK_TRIES = 5 # 获取 Webhook 结果的重试间隔,单位秒
77
+
78
+ DEL_FLAG = "__del__"
79
+ # ---- 通知配置 ----
80
+ ONLY_LINUX_NOTIFICATION = True # 是否仅在 Linux 环境下发送通知(True=非 Linux 跳过)
81
+ LARK_WEBHOOKS = {} # 飞书群机器人 Webhook 地址字典,格式: {"群名": "webhook_url", ...}
82
+ LARK_CHART_WEBHOOK = {} # 飞书图表消息 Webhook 配置
83
+
84
+ # ---- 用项目 config.settings 覆盖框架默认值 ----
85
+ try:
86
+ import config.settings as _project
87
+
88
+ _self = _sys.modules[__name__]
89
+ for _k in dir(_project):
90
+ if not _k.startswith('_'):
91
+ setattr(_self, _k, getattr(_project, _k))
92
+ except ImportError:
93
+ pass
@@ -0,0 +1,3 @@
1
+ """
2
+ 工具模块:提供日志、日期、加密、YAML、Mock、飞书通知等通用工具函数。
3
+ """