import asyncio import httpx import json ACCOUNT_ID = "8543b906ec5121d56ff7bf7ede12525d" API_TOKEN = "cfat_BUkXkpSvlQPBKr2hhKzWLbJLKGkpVkvpszMWGlI19ee2921b" DATABASE_ID = "dda9a928-e2ff-4301-aa01-b6d3dbed6188" async def test_d1(): url = f"https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/d1/database/{DATABASE_ID}/query" headers = { "Authorization": f"Bearer {API_TOKEN}", "Content-Type": "application/json" } payload = { "sql": "SELECT * FROM trust_registry LIMIT 1;" } async with httpx.AsyncClient() as client: r = await client.post(url, headers=headers, json=payload) print(f"Status: {r.status_code}") print(json.dumps(r.json(), indent=2)) if __name__ == "__main__": asyncio.run(test_d1())