File size: 843 Bytes
af1d8cd | 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 | import requests
import time
def debug_api():
print("Testing Size API...")
try:
# 1. Health check
t0 = time.time()
print("1. Pinging /health...")
res = requests.get("http://localhost:8000/health", timeout=5)
print(f" Response: {res.status_code} in {time.time() - t0:.2f}s")
# 2. Measurements endpoint
print("\n2. Pinging /size/measurements/1 ...")
t0 = time.time()
res = requests.get("http://localhost:8000/size/measurements/1", timeout=5)
print(f" Response: {res.status_code} in {time.time() - t0:.2f}s")
print(f" Body: {res.text[:100]}")
except Exception as e:
print(f"❌ API Check Failed: {e}")
print("Possibility: Backend server is hung or deadlocked.")
if __name__ == "__main__":
debug_api()
|