import os import requests import sys import json API_BASE = os.getenv("API_BASE", "http://localhost:8080") MESSAGE = os.getenv("TEST_MESSAGE", "Please verify your account at http://example.com/login") TIMEOUT = int(os.getenv("TEST_TIMEOUT", "10")) endpoints = ["/analyze", "/analyze/or1", "/analyze/or2"] print(f"Testing API at {API_BASE} with message: {MESSAGE}\n") for ep in endpoints: url = API_BASE.rstrip("/") + ep payload = {"message": MESSAGE} try: resp = requests.post(url, json=payload, timeout=TIMEOUT) try: body = resp.json() except Exception: body = resp.text print(f"Endpoint: {ep} -> Status: {resp.status_code}") print(json.dumps(body, indent=2, ensure_ascii=False)) except requests.exceptions.RequestException as e: print(f"Endpoint: {ep} -> Request failed: {e}") print("---") print("Done.")