import httpx import asyncio import json async def test_guvi_api(): url = "https://avinashanalytics-sentinel-scam-honeypo.hf.space/api/guvi/analyze" headers = { "x-api-key": "GUVI_HACKATHON_V2", "Content-Type": "application/json" } # 1. First Message payload1 = { "sessionId": "local-repro-123", "message": { "sender": "scammer", "text": "Hello, your bank account is suspended. Update KYC at http://fake.com", "timestamp": "2026-01-28T10:15:30Z" }, "conversationHistory": [], "metadata": {"channel": "SMS"} } print("\n[Test 1] Sending First Message...") async with httpx.AsyncClient(timeout=30.0) as client: try: resp1 = await client.post(url, json=payload1, headers=headers) print(f"Status: {resp1.status_code}") print(f"Response: {json.dumps(resp1.json(), indent=2)}") if resp1.status_code != 200: return # 2. Second Message (Follow-up) payload2 = { "sessionId": "local-repro-123", "message": { "sender": "scammer", "text": "Please provide your UPI ID to verify.", "timestamp": "2026-01-28T10:17:10Z" }, "conversationHistory": [ { "sender": "scammer", "text": "Hello, your bank account is suspended. Update KYC at http://fake.com", "timestamp": "2026-01-28T10:15:30Z" }, { "sender": "user", "text": "Why is it suspended?", "timestamp": "2026-01-28T10:16:10Z" } ], "metadata": {"channel": "SMS"} } print("\n[Test 2] Sending Second Message (with History)...") resp2 = await client.post(url, json=payload2, headers=headers) print(f"Status: {resp2.status_code}") print(f"Response: {json.dumps(resp2.json(), indent=2)}") except Exception as e: print(f"Error: {e}") if __name__ == "__main__": # Ensure server is running before executing this # uvicorn app.main:app --host 0.0.0.0 --port 8000 asyncio.run(test_guvi_api())