A comprehensive Python library providing easy retrieval of airport data based on IATA, ICAO, city codes, country codes, and continents. Ideal for developers building applications related to aviation, travel, and geography in Python.
- Retrieve airport data using IATA code.
- Retrieve airport data using ICAO code.
- Fetch data using city codes.
- Fetch data using country codes.
- Retrieve data based on continents.
- Built-in error handling for invalid input formats.
- Efficiently packaged with gzipped data.
- Comprehensive Data Access: Retrieve airport data using IATA code, ICAO code, city codes, country codes, and continents.
- Unique Link Integration: The first library to provide direct links to FlightRadar24, Radarbox, and FlightAware for each airport, giving users immediate access to live flight tracking and airport data.
You can install airports-py
using pip:
pip install airports-py
Here's how you can use the library:
from airports import airport_data
# Retrieve airport data using IATA code
airport_by_iata = airport_data.get_airport_by_iata("AAA")
print(airport_by_iata)
# Retrieve airport data using ICAO code
airport_by_icao = airport_data.get_airport_by_icao("NTGA")
print(airport_by_icao)
# Fetch data using city codes
airport_by_city = airport_data.get_airport_by_city_code("NYC")
print(airport_by_city)
# Fetch data using country codes
airport_by_country = airport_data.get_airport_by_country_code("US")
print(airport_by_country)
# Retrieve data based on continents
airport_by_continent = airport_data.get_airport_by_continent("AS")
print(airport_by_continent)
You can also directly execute Python code from the CLI without entering the interactive shell. Navigate to the root of your project and run:
python3 -c "from airports import airport_data; result = airport_data.get_airport_by_iata('MAA'); print(result)"
Replace 'MAA'
with other codes as needed.
To test the library locally:
- Navigate to the root of the project:
cd path_to_airports-py
- Run the tests using:
python3 -m unittest discover tests -v
This command will discover and run all test files inside the tests
directory and provide a detailed output.
For Chennai International Airport:
Field Name | Data |
---|---|
IATA | MAA |
ICAO | VOMM |
Time Zone | Asia/Kolkata |
City Code | MAA |
Country Code | IN |
Name | Chennai International Airport |
Latitude | 12.99 |
Longitude | 80.1693 |
Altitude (in feet) | 52 |
State | Tamil Nadu |
City | Pallavaram |
County | Kancheepuram |
State Code | Tamil Nadu |
Airport Type | large_airport |
Continent | AS |
State Abbreviation | IN-TN |
International | TRUE |
Wikipedia Link | Wikipedia |
Official Website | Chennai Airport |
Location ID | 12513629 |
Phone Number | 044-2340551 |
Runway Length (in meters) | 10050 |
Flightradar24 | Flightradar24 |
Radarbox | Radarbox |
Flightaware Link | Flightaware |
Field Name | Data |
---|---|
IATA | SIN |
ICAO | WSSS |
Time Zone | Asia/Singapore |
City Code | SIN |
Country Code | SG |
Name | Singapore Changi Airport |
Latitude | 1.35019 |
Longitude | 103.994 |
Altitude (in feet) | 22 |
State | Singapore |
City | Singapore |
County | Singapore |
State Code | South East |
Airport Type | large_airport |
Continent | AS |
State Abbreviation | SG-04 |
International | TRUE |
Wikipedia Link | Wikipedia |
Official Website | Changi Airport |
Location ID | 12517525 |
Phone Number | (65) 6542 1122 |
Runway Length (in meters) | 13200 |
Flightradar24 | Flightradar24 |
Radarbox | Radarbox |
Flightaware | Flightaware |
- Clone the repository:
git clone https://github.com/aashishvanand/airports-py.git
- Change into the cloned directory:
cd airports-py
- Install the necessary dependencies:
pip install -r requirements.txt
- To run tests:
python -m unittest discover tests
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.