feat: 打卡记录拉取/缺卡统计工具(iEPMS token直连, 无需签名)
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""Print a one-line summary for each captured flow.
|
||||
|
||||
Usage:
|
||||
python tools/capture/summarize.py [flows.jsonl] [keyword ...]
|
||||
"""
|
||||
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main() -> None:
|
||||
args = sys.argv[1:]
|
||||
path = Path(args[0]) if args and args[0].endswith(".jsonl") else Path("data/captures/flows.jsonl")
|
||||
keywords = [a.lower() for a in args if not a.endswith(".jsonl")]
|
||||
|
||||
for i, line in enumerate(path.read_text(encoding="utf-8").splitlines()):
|
||||
r = json.loads(line)
|
||||
if keywords and not any(k in line.lower() for k in keywords):
|
||||
continue
|
||||
size = (r["resp_body"] or {}).get("size", 0)
|
||||
print(f"{i:4d} {r['ts'][11:]} {r['method']:6s} {r['status']} {size:7d} {r['url'][:150]}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user