import requests import time import plotly.graph_objects as go fig = go.Figure(go.Scattergeo()) fig.update_layout( title='Rastreo en Tiempo Real: Estación Espacial Internacional', geo=dict(showland=True, landcolor="rgb(243, 243, 243)", countrycolor="rgb(204, 204, 204)") ) while True: try: url = "http://api.open-notify.org/iss-now.json" respuesta = requests.get(url) datos = respuesta.json() lat = float(datos["iss_position"]["latitude"]) lon = float(datos["iss_position"]["longitude"]) print(f"ISS -> Latitud: {lat}, Longitud: {lon}") fig.add_trace(go.Scattergeo(lat=[lat], lon=[lon], mode='markers', marker=dict(size=10, color='red'))) fig.write_html("rastreo_iss.html") time.sleep(5) except Exception as e: print(f"Error de conexión: {e}") time.sleep(5)