"""查设备上跑的 show_ui.py 是不是新的(有没有 wait 参数)。""" import json import sys import urllib.request try: sys.stdout.reconfigure(encoding="utf-8", errors="replace") except Exception: pass URL = "http://127.0.0.1:15199" def call(path, payload=None, method="POST", timeout=60): data = json.dumps(payload, ensure_ascii=False).encode("utf-8") if payload is not None else None req = urllib.request.Request( URL + path, data=data, method=method, headers={"Content-Type": "application/json; charset=utf-8"}, ) with urllib.request.urlopen(req, timeout=timeout) as r: return json.loads(r.read().decode("utf-8")) tools = call("/api/tools", None, "GET") py = (tools.get("python") or tools.get("tools") or []) if isinstance(py, dict): py = py.get("python") or [] found = None for t in py: if t.get("name") == "show_ui": found = t break if not found: print("!! /api/tools 里没有 show_ui;原始返回:") print(json.dumps(tools, ensure_ascii=False)[:1500]) sys.exit(1) print("show_ui 的 spec:") print(" 有 wait 参数:", "wait" in json.dumps(found.get("parameters") or {}, ensure_ascii=False)) print(" 有 timeout 参数:", "timeout" in json.dumps(found.get("parameters") or {}, ensure_ascii=False)) desc = found.get("description") or "" print(" description 里提到 wait:", "wait" in desc) print(" description 里提到'三种收尾':", "三种收尾" in desc) print() print("description 前 400 字:") print(desc[:400]) print() print("工具目录:", (tools.get("dir") or tools.get("toolsDir") or "(没报)"))