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.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

airports_py-1.0.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for airports-py-1.0.0.tar.gz
Algorithm Hash digest
SHA256 61f70fe4511c6c7f7a0a473cf896c12e856ce311ee308ab4b3dcae304282f214
MD5 d97f2b2e52cfe7971c79a8cbf23ee014
BLAKE2b-256 37438bce898e8e2966d81fb45335cdd78f5f59d8d2ab9f7f74e2099b632ab5a2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for airports_py-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 44a3e694482dcbaa57ad4ded9cb0d6a73ca72cea23f66e863e6c108cf92ccc23
MD5 669b09bdfd9399015a33e1e04e06b5e9
BLAKE2b-256 80dd7330e757633e498c44e095a3bb0ba079674ded0f4385142cdd26188db367

See more details on using hashes here.

Supported by

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