A python wrapper of the United States Federal Aviation Authority's National Airspace System API
Project description
NASSTAT - National AirSpace STATistics
#####################################################################
#####################################################################
#####███╗░░██╗░█████╗░░██████╗░██████╗████████╗░█████╗░████████╗#####
#####████╗░██║██╔══██╗██╔════╝██╔════╝╚══██╔══╝██╔══██╗╚══██╔══╝#####
#####██╔██╗██║███████║╚█████╗░╚█████╗░░░░██║░░░███████║░░░██║░░░#####
#####██║╚████║██╔══██║░╚═══██╗░╚═══██╗░░░██║░░░██╔══██║░░░██║░░░#####
#####██║░╚███║██║░░██║██████╔╝██████╔╝░░░██║░░░██║░░██║░░░██║░░░#####
#####╚═╝░░╚══╝╚═╝░░╚═╝╚═════╝░╚═════╝░░░░╚═╝░░░╚═╝░░╚═╝░░░╚═╝░░░#####
#####################################################################
#####################################################################
Last updated: Thu December 19 2025
A python wrapper of the United States Federal Aviation Authority's National Airspace System API developed by Dariel Cruz Rodriguez.
Table of Contents
Installation
Install NASSTAT via pip:
pip install nasstat
That's it! All dependencies will be installed automatically.
Dependencies
NASSTAT requires:
- Python 3.11 or higher
requests>=2.20.0- for making HTTP requests to the FAA's API (installed automatically)pytz>=2023.3- for timezone conversions (installed automatically)
The following standard library modules are also used (included with Python):
xml.etree.ElementTree- for parsing the XML response from the FAA's APIjson- for parsing the JSON response from the FAA's APIre- for regular expression matchingdatetime- for timestamp handling
Quick Start
import nasstat
# Create an airport object
airport = nasstat.Airport("JFK")
# Check for delays
if airport.isDelay():
print(f"Delays at JFK: {airport.averageDelay()} minutes")
print(f"Reason: {airport.delayReasons()}")
else:
print("No delays at JFK")
# Get detailed delay information
delays = airport.getDelays()
print(delays)
Attribution & Licensing
Attribution
Although it is not required, please attribute use of this package to the author, Dariel Cruz Rodriguez, by including a link to dariel.us in your project. As a college student, your attribution can be really helpful in building my portfolio and building a reputation in the data science community. If you are unable to attribute, or it doesn't make sense for your project, please feel free to email me about your project so I can keep an internal note of it, I would love to hear about how you are using NASSTAT!
Additionally, the data provided by the FAA is licensed under the Open Government License, which allows for free use and redistribution of the data. Thank you Uncle Sam!
MIT License
Copyright (c) 2024 Dariel Cruz Rodriguez
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Models
Airport()
Importing
You can import the Airport class in two ways:
Option 1: Import the module
import nasstat
MCO = nasstat.Airport("MCO") # loads in an instance of MCO and all associated data with it
Option 2: Import the class directly
from nasstat import Airport
MCO = Airport("MCO") # loads in an instance of MCO and all associated data with it
Attributes
airportid(str): The airport IATA/ICAO code (e.g., "MCO", "KATL")lastupdate(datetime): The timestamp of when the airport data was last updatedairportclosures(dict): Information about current airport closures, if anyairportdelays(dict): Details about current delays including minimum, maximum, average delay times, and reasonspossibledelays(dict): Information about potential upcoming delays
Methods
Airport.getDelays()
Fetches all types of delays including ground stops, ground delays, arrival delays, and departure delays. If you want to filter for specific delay types, use:
Airport.getDepartureDelays()- for departure delays onlyAirport.getArrivalDelays()- for arrival delays onlyAirport.getGroundDelays()- for ground delay programs onlyAirport.getGroundStops()- for ground stop programs only
airportcode = "MCO"
airport = Airport(airportcode)
delays = airport.getDelays()
print(delays)
# > {'Departure': {'minDelay': 31, 'maxDelay': 45, 'avgDelay': 38, 'reason': 'TM INITIATIVES:MIT:STOP&VOL'}}
airportcode = "EWR"
airport = Airport(airportcode)
delays = airport.getDelays()
print(delays)
# > {'GroundStop': {
# 'minDelay': 75,
# 'maxDelay': 75,
# 'avgDelay': 75,
# 'reason': 'thunderstorms',
# 'endTime': '2025-12-19T21:45:00+00:00',
# 'endTimeLocal': '4:45 pm EST'
# }}
# In plain language, you can access items in the dictionary to form a string.
airportcode = "MCO"
airport = Airport(airportcode)
airport.getDelays()
if airport.airportdelays is None:
print("There are no delays.")
else:
for key, value in airport.airportdelays.items():
print(f"There is a delay on {airportcode} {key}s averaging {value['avgDelay']} minutes (btwn. {value['minDelay']}-{value['maxDelay']} min) due to {value['reason']}.")
# > There is a delay on MCO Departures averaging 38 minutes (btwn. 31-45 min) due to TM INITIATIVES:MIT:STOP&VOL.
Airport.averageDelay()
airportcode = "MCO"
airport = Airport(airportcode)
print(airport.averageDelay())
# > 38.0
Airport.delayReasons()
airportcode = "PBI"
airport = Airport(airportcode)
print(airport.delayReasons())
# > "runway construction"
# This method also returns multiple reasons as a plain language string (adding 'and' at the end of the list for the last reason)
airportcode = "LGA"
airport = Airport(airportcode)
print(airport.delayReasons())
# > "runway construction, wind, and TM INITIATIVES:MIT:STOP&VOL"
Airport.getGroundStops()
Fetches ground stop program data only. Ground stops are issued when the FAA temporarily stops all departures to a specific airport, typically due to severe weather or other safety concerns.
airportcode = "EWR"
airport = Airport(airportcode)
ground_stops = airport.getGroundStops()
if ground_stops:
for category, data in ground_stops.items():
print(f"Ground stop at {airportcode}:")
print(f" Reason: {data['reason']}")
print(f" End Time (local): {data['endTimeLocal']}")
print(f" Minutes until end: {data['avgDelay']}")
else:
print("No ground stops")
# Output:
# Ground stop at EWR:
# Reason: thunderstorms
# End Time (local): 4:45 pm EST
# Minutes until end: 75
The ground stop data structure is more unique than other delay types:
minDelay(int): Minutes until the ground stop ends (same as avgDelay)maxDelay(int): Minutes until the ground stop ends (same as avgDelay)avgDelay(int): Minutes until the ground stop endsreason(str): Reason for the ground stop (e.g., "thunderstorms", "wind")endTime(str): ISO format UTC timestamp when the ground stop is expected to endendTimeLocal(str): Local time when the ground stop ends (e.g., "4:45 pm EST")
minDelay, maxDelay, avgDelay are all equal to eachother to maintain the same data structure as other delay types. It takes the local timezone of the airport's end time for ground stop, converts to UTC and subtracts it from the current UTC time, then returns the difference in minutes. If an unsupported timezone is fed through, it returns None for all fields. All mainland/territorial U.S. timezones are supported.
Airport.isDelay()
airportcode = "MCO"
airport = Airport(airportcode)
print(airport.isDelay())
# > True
airportcode = "DEN"
airport = Airport(airportcode)
print(airport.isDelay())
# > "NAASTATUS Airport Delays is empty, attempting to refresh..."
# > False
Airport.getPossibleDelays()
airportcode = "DCA"
airport = Airport(airportcode)
print(airport.getPossibleDelays())
# > {'GROUND STOP/DELAY PROGRAM POSSIBLE': 'AFTER 1930'}
Airport.getClosures()
airportcode = "LAS"
airport = Airport(airportcode)
print(airport.getClosures())
# > [{'reason': '!LAS 03/121 LAS AD AP CLSD TO NON SKED TRANSIENT GA ACFT EXC 24HR PPR 702-261-7775 2503171851-2506252300', 'start': 'Mar 17 at 18:51 UTC.', 'reopen': 'Jun 25 at 23:00 UTC.'}]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nasstat-0.1.3.tar.gz.
File metadata
- Download URL: nasstat-0.1.3.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
354ef0e6bc25b922fd38d563b46916044c12c9b41da873bb43dcb0a3544c8b51
|
|
| MD5 |
5bf615e0ebe700031c3f42dd56960ece
|
|
| BLAKE2b-256 |
bb60083a4c0e456931a952b97f19047cccc93361fd7531c3bb0978a62dd5095b
|
File details
Details for the file nasstat-0.1.3-py3-none-any.whl.
File metadata
- Download URL: nasstat-0.1.3-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f285a973ce15fce35a02e2d2a1177e84700aa4bc4d4c8c4e513c4ac35519844
|
|
| MD5 |
cd9516e4a8a754edd1dea289a422cd21
|
|
| BLAKE2b-256 |
4a914d294f68d74af2c7d970f1b2138d3cd816444bda6c436b6d190f01ecb1c3
|