Skip to main content

A comprehensive 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.

Project description

airports-py

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.

Features

  • 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.

Installation

You can install airports-py using pip:

pip install airports-py

Usage

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)

Using Command-Line Interface (CLI):

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.

Testing

To test the library locally:

  1. Navigate to the root of the project:
cd path_to_airports-py
  1. 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.

Example Data Fields

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

Singapore Changi Airport:

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

Running the Project Locally

  1. Clone the repository:
git clone https://github.com/aashishvanand/airports-py.git
  1. Change into the cloned directory:
cd airports-py
  1. Install the necessary dependencies:
pip install -r requirements.txt
  1. To run tests:
python -m unittest discover tests

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

airports-py-1.0.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

airports_py-1.0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file airports-py-1.0.1.tar.gz.

File metadata

  • Download URL: airports-py-1.0.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for airports-py-1.0.1.tar.gz
Algorithm Hash digest
SHA256 609da9bdfec12c7000c5fcce2d7cb751489851e1c6cc6ed720887036e8d715fa
MD5 c4f28059148c952134e3ea4949b63c37
BLAKE2b-256 d60f53573aa79ae0afb487c8ef6e7afd779bb868be71b4af92b9b24dc7571596

See more details on using hashes here.

File details

Details for the file airports_py-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: airports_py-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for airports_py-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3e8f1a24ec17b7c153559282611b755cd79ffb80e8db0adb09ddd44b229a7b43
MD5 254f7646f5984e07c941ce8ec235b0fc
BLAKE2b-256 fac9f4d09d46c528d5c220da40cf2893ce3762bad631e12b4021d78e58317ad1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page