import asyncio import httpx import json async def run(): async with httpx.AsyncClient() as client: # 1. Login resp = await client.post("http://localhost:8000/api/v1/auth/admin-login", json={"username": "admin", "password": "admin123"}) token = resp.json().get("access_token") # 2. Fetch tryouts list resp2 = await client.get( "http://localhost:8000/api/v1/tryout/", headers={"Authorization": f"Bearer {token}", "X-Website-ID": "1"} ) print("Tryouts list:", json.dumps(resp2.json(), indent=2)) asyncio.run(run())