You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
638 B
20 lines
638 B
|
17 hours ago
|
# -*- coding: utf-8 -*-
|
||
|
|
"""枚举 demo index.html 的 api(...) 调用首参(含模板串/拼接),评估旧契约影响面。"""
|
||
|
|
import io
|
||
|
|
import re
|
||
|
|
import sys
|
||
|
|
|
||
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
|
||
|
|
|
||
|
|
f = r"e:\code\crm-backend-matt\.scratch\customer-e2e\demo\index.html"
|
||
|
|
src = open(f, encoding="utf-8").read()
|
||
|
|
|
||
|
|
# api('xxx' / api(`/...` / api(URL 变量或拼接表达式 —— 抓前 120 字符
|
||
|
|
calls = []
|
||
|
|
for m in re.finditer(r"\bapi\(\s*([^,)]{1,140})", src):
|
||
|
|
calls.append(" ".join(m.group(1).split()))
|
||
|
|
|
||
|
|
for i, c in enumerate(calls, 1):
|
||
|
|
print(f"{i:3d}. {c}")
|
||
|
|
print(f"total {len(calls)} calls")
|