first actual data shower \o/
This commit is contained in:
parent
680d4133b2
commit
22befba3fa
25
datapull.py
25
datapull.py
|
@ -12,10 +12,29 @@ auth_header = {'x-apikey':config.FLIGHTAWAREKEY}
|
||||||
|
|
||||||
response = requests.get(apiUrl + f"airports/{airport}/flights/scheduled_departures",
|
response = requests.get(apiUrl + f"airports/{airport}/flights/scheduled_departures",
|
||||||
params=payload, headers=auth_header)
|
params=payload, headers=auth_header)
|
||||||
|
print("Flight Operator Time Destination acft-type")
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
departures = response.json()
|
departures = response.json()["scheduled_departures"]
|
||||||
print(departures)
|
name = "unknown"
|
||||||
|
operator = "unknown"
|
||||||
|
scheduled_off = "unknown"
|
||||||
|
destination = "unknown"
|
||||||
|
acfttype = "unknown"
|
||||||
|
for flight in departures:
|
||||||
|
if flight["ident"] is not None:
|
||||||
|
name = flight["ident"]
|
||||||
|
if flight["operator"] is not None:
|
||||||
|
operator = flight["operator"]
|
||||||
|
if flight["scheduled_off"] is not None:
|
||||||
|
scheduled_off = flight["scheduled_off"]
|
||||||
|
if flight["destination"] is not None:
|
||||||
|
if flight["destination"]["name"] is not None:
|
||||||
|
destination = (flight["destination"]["code_icao"] + " " + flight["destination"]["name"])
|
||||||
|
if flight["aircraft_type"] is not None:
|
||||||
|
acfttype = flight["aircraft_type"]
|
||||||
|
|
||||||
|
|
||||||
|
print(name + " " + operator + " " + scheduled_off + " " + destination + " " + acfttype)
|
||||||
else:
|
else:
|
||||||
print("Error executing request")
|
print("Error executing request")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue