sunnyware / force_test.py
shamiur's picture
chore(release): v1.48.0
bea0081
Raw History Blame Contribute Delete
1.78 kB
import urllib.request
import json
url = "https://shamiur-sunnyware.hf.space/api/tools-test-all?force=1"
req = urllib.request.Request(url, method="POST", data=b"{}")
req.add_header("Content-Type", "application/json")
req.add_header("x-api-key", "master-admin-key")
print("Calling cloud endpoint (FORCE mode, timeout 900s)...")
try:
with urllib.request.urlopen(req, timeout=900) as response:
data = json.loads(response.read().decode("utf-8"))
s = data.get("summary", {})
print("")
print("=== FORCE MODE SUMMARY ===")
print(" Total: " + str(s.get('total')))
print(" Passed: " + str(s.get('passed')))
print(" Failed: " + str(s.get('failed')))
print(" Skipped: " + str(s.get('skipped')))
print("")
print("=== FAILURES (honest — need real infrastructure) ===")
fails = [r for r in data.get("results", []) if r["status"] == "FAIL"]
if not fails:
print(" (none)")
for r in fails:
print(" " + r['name'] + ": " + r['error'][:120])
print("")
print("=== SKIPPED (destructive — not auto-run) ===")
skips = [r for r in data.get("results", []) if r["status"] == "SKIP"]
for r in skips:
print(" " + r['name'] + ": " + (r['error'] or 'no reason'))
print("")
print("=== PASSING TOOLS ===")
passes = [r for r in data.get("results", []) if r["status"] == "PASS"]
for r in passes:
print(" " + r['name'] + " (" + str(r['latency_ms']) + "ms)")
except urllib.error.HTTPError as e:
print("HTTP Error " + str(e.code) + ": " + str(e.reason))
print(e.read().decode("utf-8", errors="replace")[:300])
except Exception as e:
print("Error: " + str(e))