import requests import sys def check_api(): url = "http://localhost:8000/api/celestial/positions" try: response = requests.get(url, timeout=5) response.raise_for_status() data = response.json() bodies = data.get("bodies", []) print(f"API returned {len(bodies)} bodies.") targets = [b for b in bodies if b.get("name") in ["Earth", "Jupiter"]] for t in targets: print(f"Body: {t.get('name')}") print(f" Keys: {list(t.keys())}") print(f" Extra Data: {t.get('extra_data')}") if t.get('extra_data'): print(f" Real Radius: {t.get('extra_data', {}).get('real_radius')}") else: print(" Real Radius: MISSING") except Exception as e: print(f"Error checking API: {e}") if __name__ == "__main__": check_api()