import urllib.request
import json

API_KEY = "KEY019BE7A3A2D749FCA8681CFF8448A7F0_vTMM1n77CtQxLDT2ra3P1z"
BASE = "https://api.telnyx.com/v2"

def get(path):
    req = urllib.request.Request(
        f"{BASE}{path}",
        headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}
    )
    try:
        resp = urllib.request.urlopen(req, timeout=10)
        return json.loads(resp.read())
    except Exception as e:
        return {"error": str(e)}

# Check number
print("=== Phone Number 4377 ===")
r = get("/phone_numbers?filter[phone_number]=%2B61731304377")
print(json.dumps(r, indent=2))

# Check AI assistants
print("\n=== AI Assistants ===")
r2 = get("/ai/assistants")
print(json.dumps(r2, indent=2))
