{"id":51126547,"url":"https://github.com/apiverve/airport-distance-python-tutorial","last_synced_at":"2026-06-25T08:01:59.238Z","repository":{"id":338751482,"uuid":"1158996689","full_name":"apiverve/airport-distance-python-tutorial","owner":"apiverve","description":"Airport distance calculator that calculates distance between airports using Python","archived":false,"fork":false,"pushed_at":"2026-02-16T07:40:17.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-16T15:18:08.048Z","etag":null,"topics":["airport","apiverve","aviation","cli","distance-calculator","iata-codes","python","travel","tutorial"],"latest_commit_sha":null,"homepage":"https://apiverve.com/marketplace/airportdistance","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apiverve.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-16T07:19:19.000Z","updated_at":"2026-02-16T07:40:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/apiverve/airport-distance-python-tutorial","commit_stats":null,"previous_names":["apiverve/airport-distance-python-tutorial"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/apiverve/airport-distance-python-tutorial","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiverve%2Fairport-distance-python-tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiverve%2Fairport-distance-python-tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiverve%2Fairport-distance-python-tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiverve%2Fairport-distance-python-tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apiverve","download_url":"https://codeload.github.com/apiverve/airport-distance-python-tutorial/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiverve%2Fairport-distance-python-tutorial/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34765322,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-25T02:00:05.521Z","response_time":101,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["airport","apiverve","aviation","cli","distance-calculator","iata-codes","python","travel","tutorial"],"created_at":"2026-06-25T08:01:59.145Z","updated_at":"2026-06-25T08:01:59.229Z","avatar_url":"https://github.com/apiverve.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Airport Distance Calculator | APIVerve API Tutorial\r\n\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\r\n[![Build](https://img.shields.io/badge/Build-Passing-brightgreen.svg)]()\r\n[![Python](https://img.shields.io/badge/Python-3.8+-3776ab)](https://python.org)\r\n[![APIVerve | Airport Distance](https://img.shields.io/badge/APIVerve-Airport_Distance-purple)](https://apiverve.com/marketplace/airportdistance?utm_source=github\u0026utm_medium=tutorial\u0026utm_campaign=airport-distance-python-tutorial)\r\n\r\nA Python CLI tool to calculate the distance between any two airports. Enter IATA codes and get the distance in miles and kilometers, plus detailed airport information.\r\n\r\n![Screenshot](https://raw.githubusercontent.com/apiverve/airport-distance-python-tutorial/main/screenshot.jpg)\r\n\r\n---\r\n\r\n### Get Your Free API Key\r\n\r\nThis tutorial requires an APIVerve API key. **[Sign up free](https://dashboard.apiverve.com?utm_source=github\u0026utm_medium=tutorial\u0026utm_campaign=airport-distance-python-tutorial)** - no credit card required.\r\n\r\n---\r\n\r\n## Features\r\n\r\n- Calculate distance between any two airports\r\n- Distance in miles and kilometers\r\n- Detailed airport information\r\n- IATA and ICAO codes\r\n- City, state, country data\r\n- Elevation and coordinates\r\n- Estimated flight time\r\n- Popular route presets\r\n\r\n## Quick Start\r\n\r\n1. **Clone this repository**\r\n   ```bash\r\n   git clone https://github.com/apiverve/airport-distance-python-tutorial.git\r\n   cd airport-distance-python-tutorial\r\n   ```\r\n\r\n2. **Install dependencies**\r\n   ```bash\r\n   pip install -r requirements.txt\r\n   ```\r\n\r\n3. **Set your API key**\r\n   ```bash\r\n   export APIVERVE_API_KEY=your-api-key-here\r\n   ```\r\n\r\n4. **Run the calculator**\r\n   ```bash\r\n   python distance.py\r\n   ```\r\n\r\n## Project Structure\r\n\r\n```\r\nairport-distance-python-tutorial/\r\n├── distance.py         # Main Python script\r\n├── requirements.txt    # Python dependencies\r\n├── screenshot.jpg      # Preview image\r\n├── LICENSE             # MIT license\r\n├── .gitignore          # Git ignore rules\r\n└── README.md           # This file\r\n```\r\n\r\n## How It Works\r\n\r\n1. Enter two IATA airport codes\r\n2. API looks up both airports\r\n3. Calculates great-circle distance\r\n4. Returns full airport details\r\n\r\n### The API Call\r\n\r\n```python\r\nresponse = requests.get('https://api.apiverve.com/v1/airportdistance',\r\n    headers={'x-api-key': API_KEY},\r\n    params={\r\n        'airport1': 'JFK',\r\n        'airport2': 'LAX'\r\n    }\r\n)\r\n```\r\n\r\n## API Reference\r\n\r\n**Endpoint:** `GET https://api.apiverve.com/v1/airportdistance`\r\n\r\n**Query Parameters:**\r\n\r\n| Parameter | Type | Required | Description |\r\n|-----------|------|----------|-------------|\r\n| `airport1` | string | Yes | First airport IATA code |\r\n| `airport2` | string | Yes | Second airport IATA code |\r\n\r\n**Example Response:**\r\n\r\n```json\r\n{\r\n  \"status\": \"ok\",\r\n  \"error\": null,\r\n  \"data\": {\r\n    \"distanceMiles\": 2470.23,\r\n    \"distanceKm\": 3974.2,\r\n    \"airport1\": {\r\n      \"name\": \"John F Kennedy International Airport\",\r\n      \"iata\": \"JFK\",\r\n      \"icao\": \"KJFK\",\r\n      \"city\": \"New York\",\r\n      \"state\": \"New-York\",\r\n      \"country\": \"US\",\r\n      \"elevation\": 13,\r\n      \"latitude\": 40.63980103,\r\n      \"longitude\": -73.77890015\r\n    },\r\n    \"airport2\": {\r\n      \"name\": \"Los Angeles International Airport\",\r\n      \"iata\": \"LAX\",\r\n      \"icao\": \"KLAX\",\r\n      \"city\": \"Los Angeles\",\r\n      \"state\": \"California\",\r\n      \"country\": \"US\",\r\n      \"elevation\": 125,\r\n      \"latitude\": 33.94250107,\r\n      \"longitude\": -118.4079971\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## Airport Data Fields\r\n\r\n| Field | Description |\r\n|-------|-------------|\r\n| `name` | Full airport name |\r\n| `iata` | 3-letter IATA code |\r\n| `icao` | 4-letter ICAO code |\r\n| `city` | City name |\r\n| `state` | State/province/region |\r\n| `country` | Country code |\r\n| `elevation` | Elevation in feet |\r\n| `latitude` | Latitude coordinate |\r\n| `longitude` | Longitude coordinate |\r\n\r\n## Popular Routes\r\n\r\n| Route | Distance |\r\n|-------|----------|\r\n| JFK → LAX | 2,470 miles |\r\n| LHR → JFK | 3,451 miles |\r\n| SFO → NRT | 5,130 miles |\r\n| DXB → SIN | 3,637 miles |\r\n| SYD → LAX | 7,488 miles |\r\n\r\n## Common IATA Codes\r\n\r\n| Code | Airport |\r\n|------|---------|\r\n| JFK | New York JFK |\r\n| LAX | Los Angeles |\r\n| LHR | London Heathrow |\r\n| CDG | Paris Charles de Gaulle |\r\n| NRT | Tokyo Narita |\r\n| DXB | Dubai |\r\n| SIN | Singapore Changi |\r\n| SYD | Sydney |\r\n| ORD | Chicago O'Hare |\r\n| ATL | Atlanta |\r\n\r\n## Customization Ideas\r\n\r\n- Add route visualization on map\r\n- Calculate carbon emissions\r\n- Compare multiple routes\r\n- Find nearest airports\r\n- Build flight search\r\n- Add layover calculations\r\n\r\n## Related APIs\r\n\r\nExplore more APIs at [APIVerve](https://apiverve.com/marketplace?utm_source=github\u0026utm_medium=tutorial\u0026utm_campaign=airport-distance-python-tutorial):\r\n\r\n- [Airports Lookup](https://apiverve.com/marketplace/airportslookup?utm_source=github\u0026utm_medium=tutorial\u0026utm_campaign=airport-distance-python-tutorial) - Search airports\r\n- [Airline Lookup](https://apiverve.com/marketplace/airlinelookup?utm_source=github\u0026utm_medium=tutorial\u0026utm_campaign=airport-distance-python-tutorial) - Airline information\r\n- [Distance Calculator](https://apiverve.com/marketplace/distancecalculator?utm_source=github\u0026utm_medium=tutorial\u0026utm_campaign=airport-distance-python-tutorial) - General distance calc\r\n\r\n## Free Plan Note\r\n\r\nThis tutorial works with the free APIVerve plan. Some APIs may have:\r\n- **Locked fields**: Premium response fields return `null` on free plans\r\n- **Ignored parameters**: Some optional parameters require a paid plan\r\n\r\nThe API response includes a `premium` object when limitations apply. [Upgrade anytime](https://dashboard.apiverve.com/plans) to unlock all features.\r\n\r\n## License\r\n\r\nMIT - see [LICENSE](LICENSE)\r\n\r\n## Links\r\n\r\n- [Get API Key](https://dashboard.apiverve.com?utm_source=github\u0026utm_medium=tutorial\u0026utm_campaign=airport-distance-python-tutorial) - Sign up free\r\n- [APIVerve Marketplace](https://apiverve.com/marketplace?utm_source=github\u0026utm_medium=tutorial\u0026utm_campaign=airport-distance-python-tutorial) - Browse 300+ APIs\r\n- [Airport Distance API](https://apiverve.com/marketplace/airportdistance?utm_source=github\u0026utm_medium=tutorial\u0026utm_campaign=airport-distance-python-tutorial) - API details\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapiverve%2Fairport-distance-python-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapiverve%2Fairport-distance-python-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapiverve%2Fairport-distance-python-tutorial/lists"}