How to Extract Airport Schedule Data with Python
Airport schedule data is crucial for flight tracking, travel planning, airline operations, and aviation analytics. In this guide, we will demonstrate how to extract real-time airport schedule data using Python.
By the end of this tutorial, you’ll be able to fetch flight arrival and departure schedules using a simple API request.
What is Airport Schedule Data?
- Arrival & departure times
- Flight numbers & airline details
- Terminal & gate information
- Flight status (on-time, delayed, canceled, etc.)
- Origin & destination details
Requirements
I hope you have already installed Python on your machine, if not then you can download it from here. Then create a folder where we will keep all the files.
mkdir flightdata
Then inside this folder install requests
and pandas
library.
requests
for making an HTTP connection with the data host.pandas
for saving the data to a CSV file.
pip install requests
Now, create a Python file using any name you like. I am naming the file as schedule.py
. The final step would be to create a trial account on FlightAPI. You will get 30 credits for testing the API.
Extracting Airport Schedule Data
Once you sign up for the trial pack you will be redirected to the dashboard which will look like this.

Before proceeding with the coding it would be great to read the documentation to get the full idea of how the API works.
import requests
API_KEY = "your-api-key"
AIRPORT_CODE = "JFK"
mode="arrivals"
URL = f"https://api.flightapi.io/schedule/62677fded20b140b78fa40bc?mode={mode}&iata={AIRPORT_CODE}&day=1"
response = requests.get(URL)
if response.status_code == 200:
airport_data = response.json()
print(airport_data)
else:
print(f"Error: {response.status_code}")
Let me briefly explain the code.
- First, we imported the requests library.
- Then we declared a few parameters like
AIRPORT_CODE
which will be the airport code of the target Airport, themode
tells whether you need data of arriving flights or departing flights, and theAPI_KEY
. Also,data
parameter acts as the page number here. So, you can check it’s value to get the data of the next page. - Then we made the GET request using requests.
- Finally, we are collecting the data by printing it on the console.
Let’s run the code and see what appears.

You got a beautiful JSON response for all the arriving flights at JFK. Let’s parse the schedule data out of this huge JSON data.
For your simplification, the data looks like this.

From this, we need schedule data. But if you need weather or aircraft image data then you can parse that too.
import requests
o={}
l=[]
API_KEY = "your-api-key"
AIRPORT_CODE = "JFK" # Replace with your airport code
mode="arrivals"
URL = f"https://api.flightapi.io/schedule/62677fded20b140b78fa40bc?mode={mode}&iata={AIRPORT_CODE}&day=1"
response = requests.get(URL)
if response.status_code == 200:
airport_data = response.json()
completeData=airport_data['airport']['pluginData']['schedule']['arrivals']['data']
for i in range(0,len(completeData)):
try:
o["flight"]=completeData[i]['flight']['aircraft']['model']["text"]
except:
o["flight"]=None
try:
o["departure"]=completeData[i]['flight']['time']['scheduled']['departure']
except:
o["departure"]=None
try:
o["arrival"]=completeData[i]['flight']['time']['scheduled']['arrival']
except:
o["arrival"]=None
l.append(o)
o={}
print(l)
else:
print(response.text)
print(f"Error: {response.status_code}")
After running the code you will get this parsed JSON response.

Saving the data to a CSV file
Our parsing is done now let’s save the data directly to a CSV file. We will use pandas
for this process.
import requests
import pandas as pd
o={}
l=[]
API_KEY = "your-api-key"
AIRPORT_CODE = "JFK" # Replace with your airport code
mode="arrivals"
URL = f"https://api.flightapi.io/schedule/62677fded20b140b78fa40bc?mode={mode}&iata={AIRPORT_CODE}&day=1"
response = requests.get(URL)
if response.status_code == 200:
airport_data = response.json()
completeData=airport_data['airport']['pluginData']['schedule']['arrivals']['data']
print(len(completeData))
for i in range(0,len(completeData)):
try:
o["flight"]=completeData[i]['flight']['aircraft']['model']["text"]
except:
o["flight"]=None
try:
o["departure"]=completeData[i]['flight']['time']['scheduled']['departure']
except:
o["departure"]=None
try:
o["arrival"]=completeData[i]['flight']['time']['scheduled']['arrival']
except:
o["arrival"]=None
l.append(o)
o={}
df = pd.DataFrame(l)
df.to_csv('schedule.csv', index=False, encoding='utf-8')
print("done")
else:
print(response.text)
print(f"Error: {response.status_code}")
Once you run this code you will see a CSV file by the name schedule.csv
inside your folder.

Conclusion
Extracting airport schedule data using Python and FlightAPI.io is a powerful way to access real-time flight arrivals, departures, and status updates. By leveraging APIs, we can efficiently fetch, process, and analyze flight data without relying on manual tracking or unreliable sources.
Apart from airport schedule data, FlightAPI.io offers a range of other services, including flight price comparison data from different vendors through its Flight Price API. You can explore the documentation for different trip types:
Additionally, it offers a Flight Status API that allows you to retrieve real-time flight tracking data using Python, including flight number, departure airport, scheduled departure time, arrival airport, and scheduled arrival time. If you prefer a no-code solution, check out our step-by-step tutorial on automating flight status data extraction using Google Sheets.