import asyncio import httpx import json import sys # LIVE TARGET TARGET_URL = "https://avinashanalytics-sentinel-scam-honeypo.hf.space/api/guvi/analyze" async def validate_live_deployment(): print(f"šŸš€ STARTING LIVE VALIDATION: {TARGET_URL}") print("────────────────────────────────────────────────────────") payload = { "sessionId": "LIVE-AUDIT-001", "message": { "text": "Your bank account is locked. Click here to verify: http://bit.ly/scam", "sender": "scammer" }, "metadata": {"source": "validator_script"} } headers = { "x-api-key": "GUVI_HACKATHON_V2", # Updated based on user input "Content-Type": "application/json" } try: async with httpx.AsyncClient(timeout=15.0) as client: start_time = asyncio.get_event_loop().time() resp = await client.post(TARGET_URL, json=payload, headers=headers) end_time = asyncio.get_event_loop().time() latency = (end_time - start_time) * 1000 print(f"šŸ“” Status Code: {resp.status_code}") print(f"ā±ļø Latency: {latency:.2f}ms") if resp.status_code == 200: data = resp.json() print(f"āœ… Response Body: {json.dumps(data, indent=2)}") # Compliance Checks failures = [] if "scamDetected" not in data: failures.append("Missing 'scamDetected'") if "extractedIntelligence" not in data: failures.append("Missing 'extractedIntelligence'") if "engagementMetrics" not in data: failures.append("Missing 'engagementMetrics'") # Check CamelCase if "riskLevel" not in data and "risk_level" in data: failures.append("Schema Violation: snake_case found instead of camelCase") if not failures: print(f"\nšŸŽ‰ LIVE DEPLOYMENT IS COMPLIANT! (GUVI_HACKATHON_V2)") print("Status: READY FOR JUDGES") else: print(f"\nāŒ COMPLIANCE FAILURES: {failures}") else: print(f"āŒ API Request Failed: {resp.text}") except Exception as e: print(f"āš ļø Network/System Error: {e}") if __name__ == "__main__": asyncio.run(validate_live_deployment())