Spaces:
Sleeping
Sleeping
File size: 961 Bytes
36fffc4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | import requests
import json
BASE_URL = "https://printf-sourav-cicd.hf.space"
def print_res(name, res):
print(f"\n--- Testing HTTP {name} ---")
print(f"Status Code: {res.status_code}")
try:
print(json.dumps(res.json(), indent=2)[:300] + "...")
except:
print(res.text)
print("Starting live endpoint verification...\n")
# 1. Root Endpoint
print_res("GET /", requests.get(f"{BASE_URL}/"))
# 2. Health Endpoint
print_res("GET /health", requests.get(f"{BASE_URL}/health"))
# 3. Reset Endpoint (Initialize to a specific task)
reset_res = requests.post(f"{BASE_URL}/reset", json={"task_id": "easy-command-typo"})
print_res("POST /reset", reset_res)
# 4. State Endpoint (Checking internals after reset)
print_res("GET /state", requests.get(f"{BASE_URL}/state"))
# 5. Step Endpoint (Taking an action)
step_payload = {"action": "read_logs"}
print_res("POST /step (read_logs)", requests.post(f"{BASE_URL}/step", json=step_payload))
|