fill aircraft type/registration and terminal/gate from AeroDataBox
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user