# 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](https://www.flightradar24.com/), [Radarbox](https://www.radarbox.com/), and [FlightAware](https://www.flightaware.com/) for each airport, giving users immediate access to live flight tracking and airport data.
## Installation
You can install `airports-py` using pip:
```bash
pip install airports-py
```
## Usage
Here's how you can use the library:
```python
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:
```bash
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:
```bash
cd path_to_airports-py
```
2. Run the tests using:
```bash
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](https://en.wikipedia.org/wiki/Chennai_International_Airport)|
| Official Website | [Chennai Airport](http://chennaiairport.com) |
| Location ID | 12513629 |
| Phone Number | 044-2340551 |
| Runway Length (in meters) | 10050 |
| Flightradar24 | [Flightradar24](https://www.flightradar24.com/airport/MAA)|
| Radarbox | [Radarbox](https://www.radarbox.com/airport/VOMM) |
| Flightaware Link | [Flightaware](https://www.flightaware.com/live/airport/VOMM)|
### 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](https://en.wikipedia.org/wiki/Singapore_Changi_Airport)|
| Official Website | [Changi Airport](http://www.changiairport.com/) |
| Location ID | 12517525 |
| Phone Number | (65) 6542 1122 |
| Runway Length (in meters) | 13200 |
| Flightradar24 | [Flightradar24](https://www.flightradar24.com/airport/SIN)|
| Radarbox | [Radarbox](https://www.radarbox.com/airport/WSSS) |
| Flightaware | [Flightaware](https://www.flightaware.com/live/airport/WSSS)|
## Running the Project Locally
1. Clone the repository:
```bash
git clone https://github.com/aashishvanand/airports-py.git
```
2. Change into the cloned directory:
```bash
cd airports-py
```
3. Install the necessary dependencies:
```bash
pip install -r requirements.txt
```
4. To run tests:
```bash
python -m unittest discover tests
```
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/aashishvanand/airports-py/issues).
Raw data
{
"_id": null,
"home_page": "https://aashishvanand.me/airport-data-js/",
"name": "airports-py",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "airport,iata,icao,data,library,aviation,travel,geography,lookup,codes,continent,city,country,flightradar24,radarbox,flightaware",
"author": "Aashish Vivekanand",
"author_email": "aashishvanand@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/d6/0f/53573aa79ae0afb487c8ef6e7afd779bb868be71b4af92b9b24dc7571596/airports-py-1.0.1.tar.gz",
"platform": null,
"description": "# airports-py\n\nA 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.\n\n## Features\n\n- Retrieve airport data using IATA code.\n- Retrieve airport data using ICAO code.\n- Fetch data using city codes.\n- Fetch data using country codes.\n- Retrieve data based on continents.\n- Built-in error handling for invalid input formats.\n- Efficiently packaged with gzipped data.\n- **Comprehensive Data Access**: Retrieve airport data using IATA code, ICAO code, city codes, country codes, and continents.\n- **Unique Link Integration**: The first library to provide direct links to [FlightRadar24](https://www.flightradar24.com/), [Radarbox](https://www.radarbox.com/), and [FlightAware](https://www.flightaware.com/) for each airport, giving users immediate access to live flight tracking and airport data.\n\n## Installation\n\nYou can install `airports-py` using pip:\n\n```bash\npip install airports-py\n```\n\n## Usage\n\nHere's how you can use the library:\n\n```python\nfrom airports import airport_data\n\n# Retrieve airport data using IATA code\nairport_by_iata = airport_data.get_airport_by_iata(\"AAA\")\nprint(airport_by_iata)\n\n# Retrieve airport data using ICAO code\nairport_by_icao = airport_data.get_airport_by_icao(\"NTGA\")\nprint(airport_by_icao)\n\n# Fetch data using city codes\nairport_by_city = airport_data.get_airport_by_city_code(\"NYC\")\nprint(airport_by_city)\n\n# Fetch data using country codes\nairport_by_country = airport_data.get_airport_by_country_code(\"US\")\nprint(airport_by_country)\n\n# Retrieve data based on continents\nairport_by_continent = airport_data.get_airport_by_continent(\"AS\")\nprint(airport_by_continent)\n```\n\n### Using Command-Line Interface (CLI):\n\nYou can also directly execute Python code from the CLI without entering the interactive shell. Navigate to the root of your project and run:\n\n```bash\npython3 -c \"from airports import airport_data; result = airport_data.get_airport_by_iata('MAA'); print(result)\"\n```\n\nReplace `'MAA'` with other codes as needed.\n\n## Testing\n\nTo test the library locally:\n\n1. Navigate to the root of the project:\n\n```bash\ncd path_to_airports-py\n```\n\n2. Run the tests using:\n\n```bash\npython3 -m unittest discover tests -v\n```\n\nThis command will discover and run all test files inside the `tests` directory and provide a detailed output.\n\n## Example Data Fields\n\nFor Chennai International Airport:\n\n| Field Name | Data |\n|----------------------|----------------------------------------------------------|\n| IATA | MAA |\n| ICAO | VOMM |\n| Time Zone | Asia/Kolkata |\n| City Code | MAA |\n| Country Code | IN |\n| Name | Chennai International Airport |\n| Latitude | 12.99 |\n| Longitude | 80.1693 |\n| Altitude (in feet) | 52 |\n| State | Tamil Nadu |\n| City | Pallavaram |\n| County | Kancheepuram |\n| State Code | Tamil Nadu |\n| Airport Type | large_airport |\n| Continent | AS |\n| State Abbreviation | IN-TN |\n| International | TRUE |\n| Wikipedia Link | [Wikipedia](https://en.wikipedia.org/wiki/Chennai_International_Airport)|\n| Official Website | [Chennai Airport](http://chennaiairport.com) |\n| Location ID | 12513629 |\n| Phone Number | 044-2340551 |\n| Runway Length (in meters) | 10050 |\n| Flightradar24 | [Flightradar24](https://www.flightradar24.com/airport/MAA)|\n| Radarbox | [Radarbox](https://www.radarbox.com/airport/VOMM) |\n| Flightaware Link | [Flightaware](https://www.flightaware.com/live/airport/VOMM)|\n\n### Singapore Changi Airport:\n\n| Field Name | Data |\n|----------------------|----------------------------------------------------------|\n| IATA | SIN |\n| ICAO | WSSS |\n| Time Zone | Asia/Singapore |\n| City Code | SIN |\n| Country Code | SG |\n| Name | Singapore Changi Airport |\n| Latitude | 1.35019 |\n| Longitude | 103.994 |\n| Altitude (in feet) | 22 |\n| State | Singapore |\n| City | Singapore |\n| County | Singapore |\n| State Code | South East |\n| Airport Type | large_airport |\n| Continent | AS |\n| State Abbreviation | SG-04 |\n| International | TRUE |\n| Wikipedia Link | [Wikipedia](https://en.wikipedia.org/wiki/Singapore_Changi_Airport)|\n| Official Website | [Changi Airport](http://www.changiairport.com/) |\n| Location ID | 12517525 |\n| Phone Number | (65) 6542 1122 |\n| Runway Length (in meters) | 13200 |\n| Flightradar24 | [Flightradar24](https://www.flightradar24.com/airport/SIN)|\n| Radarbox | [Radarbox](https://www.radarbox.com/airport/WSSS) |\n| Flightaware | [Flightaware](https://www.flightaware.com/live/airport/WSSS)|\n\n\n## Running the Project Locally\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/aashishvanand/airports-py.git\n```\n\n2. Change into the cloned directory:\n\n```bash\ncd airports-py\n```\n\n3. Install the necessary dependencies:\n\n```bash\npip install -r requirements.txt\n```\n\n4. To run tests:\n\n```bash\npython -m unittest discover tests\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/aashishvanand/airports-py/issues).\n",
"bugtrack_url": null,
"license": "",
"summary": "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.",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://aashishvanand.me/airport-data-js/",
"Source Code": "https://github.com/aashishvanand/airports-py"
},
"split_keywords": [
"airport",
"iata",
"icao",
"data",
"library",
"aviation",
"travel",
"geography",
"lookup",
"codes",
"continent",
"city",
"country",
"flightradar24",
"radarbox",
"flightaware"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fac9f4d09d46c528d5c220da40cf2893ce3762bad631e12b4021d78e58317ad1",
"md5": "254f7646f5984e07c941ce8ec235b0fc",
"sha256": "3e8f1a24ec17b7c153559282611b755cd79ffb80e8db0adb09ddd44b229a7b43"
},
"downloads": -1,
"filename": "airports_py-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "254f7646f5984e07c941ce8ec235b0fc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5381,
"upload_time": "2023-10-16T06:36:15",
"upload_time_iso_8601": "2023-10-16T06:36:15.207681Z",
"url": "https://files.pythonhosted.org/packages/fa/c9/f4d09d46c528d5c220da40cf2893ce3762bad631e12b4021d78e58317ad1/airports_py-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d60f53573aa79ae0afb487c8ef6e7afd779bb868be71b4af92b9b24dc7571596",
"md5": "c4f28059148c952134e3ea4949b63c37",
"sha256": "609da9bdfec12c7000c5fcce2d7cb751489851e1c6cc6ed720887036e8d715fa"
},
"downloads": -1,
"filename": "airports-py-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "c4f28059148c952134e3ea4949b63c37",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4903,
"upload_time": "2023-10-16T06:36:16",
"upload_time_iso_8601": "2023-10-16T06:36:16.809162Z",
"url": "https://files.pythonhosted.org/packages/d6/0f/53573aa79ae0afb487c8ef6e7afd779bb868be71b4af92b9b24dc7571596/airports-py-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-16 06:36:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aashishvanand",
"github_project": "airports-py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "airports-py"
}