File size: 1,953 Bytes
b5e0c5c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
34
35
36
37
38
39
40
41
42
43
44
45
46
import asyncio
import httpx

async def check():
    print("="*50)
    print("LIVE ENVIRONMENT PREFLIGHT CHECK")
    print("="*50)
    
    try:
        print("\nChecking Node (kode-animator-federation-node.hf.space)...")
        async with httpx.AsyncClient(timeout=10.0) as c:
            r = await c.get("https://kode-animator-federation-node.hf.space/")
            r.raise_for_status()
            data = r.json()
            print("🟒 Node is UP")
            print(f"   Identity: {data.get('identity')}")
            print(f"   Status: {data.get('status')}")
    except Exception as e:
        print(f"πŸ”΄ Node check failed: {e}")

    try:
        print("\nChecking Bridge (kode-animator-federation-bridge.hf.space)...")
        async with httpx.AsyncClient(timeout=10.0) as c:
            r = await c.get("https://kode-animator-federation-bridge.hf.space/")
            r.raise_for_status()
            data = r.json()
            print("🟒 Bridge is UP")
            print(f"   Service: {data.get('service')}")
            print(f"   Target Node config: {data.get('bridge_target_node')}")
            
        print("\nChecking Bridge /sse endpoint...")
        async with httpx.AsyncClient(timeout=10.0) as c:
            # We just do a HEAD or GET expecting an SSE stream or 422/Method Not Allowed/etc
            r = await c.get("https://kode-animator-federation-bridge.hf.space/sse")
            # Usually SSE endpoint might wait forever, but we can check status
            print(f"🟒 Bridge /sse endpoint returned status: {r.status_code}")
    except httpx.HTTPStatusError as e:
        print(f"πŸ”΄ Bridge check HTTP error: {e.response.status_code}")
        print(f"   Response: {e.response.text[:200]}")
    except httpx.ReadTimeout:
        print("🟒 Bridge /sse is waiting for connection (Timeout as expected for SSE stream)")
    except Exception as e:
        print(f"πŸ”΄ Bridge check failed: {e}")

asyncio.run(check())