MSFS_Simbrief/Simbriefimport.py
2025-11-30 14:42:10 +01:00

31 lines
No EOL
780 B
Python

import requests
USERNAME = "hubobel"
URL = "https://www.simbrief.com/api/xml.fetcher.php"
params = {
"username": USERNAME,
"json": 1, # JSON statt XML
}
resp = requests.get(URL, params=params, timeout=15)
# Prüfen, ob Request OK war
resp.raise_for_status()
data = resp.json() # dict
# Überblick verschaffen: Top-Level-Keys ausgeben
print(data.keys())
# Typische Bereiche (abhängig von deinem Flugplan):
general = data.get("general", {})
origin = data.get("origin", {})
dest = data.get("destination", {})
print("Airline:", general.get("icao_airline"))
print("Flugnummer:", general.get("flight_number"))
print("Abflug ICAO:", origin.get("icao_code"))
print("Ziel ICAO:", dest.get("icao_code"))
print("Geplante Blockzeit:", general.get("times"))
print()