fill aircraft type/registration and terminal/gate from AeroDataBox

This commit is contained in:
2026-09-15 22:58:54 +10:00
parent 480b896d39
commit 4ed4dd1ec2
6 changed files with 391 additions and 29 deletions
+16
View File
@@ -104,6 +104,22 @@ def _fetch_gate_times(flight_number: str, flight_date: date, updates: dict) -> N
# AeroDataBox came up empty.
updates["takeoff_actual"] = gate_times.get("takeoffActual")
updates["landing_actual"] = gate_times.get("landingActual")
updates["departure_terminal"] = gate_times.get("departureTerminal")
updates["departure_gate"] = gate_times.get("departureGate")
updates["arrival_terminal"] = gate_times.get("arrivalTerminal")
updates["arrival_gate"] = gate_times.get("arrivalGate")
registration = gate_times.get("aircraftReg")
updates["aircraft_reg"] = registration
updates["aircraft_icao"] = None
if registration:
# One extra API unit, and only worth spending once we actually have a
# registration to look up. A failure here is not worth losing the rest
# of the lookup over - the registration alone still reaches AirTrail.
try:
updates["aircraft_icao"] = aerodatabox.lookup_aircraft_icao(registration)
except aerodatabox.AeroDataBoxError as e:
log.warning("aircraft type lookup failed for %s: %s", registration, e)
def process_one_flight(row: dict) -> None: