Spaces:
Running on Zero
Running on Zero
Download force_test.py from shamiur/sunnyware: direct link, hf CLI and curl.
- Browser
- Download file 1.78 kB
-
https://huggingface.co/spaces/shamiur/sunnyware/resolve/main/force_test.py
- Command line
-
hf download hf://spaces/shamiur/sunnyware/force_test.py
-
curl -L -o force_test.py https://huggingface.co/spaces/shamiur/sunnyware/resolve/main/force_test.py
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)) | |