flights.py is a python script that finds a third city to fly through and explore for your itinerary.
A round trip flight can be represented as a graph with nodes A and B, and edges A->B and B->A. The goal is to find a city (a new node C) which can be visited by either from B or A (so the new edges could be A->B B->C C->A or A->C C->B B->A). The total price of transportation for all three edges should be less than $x more than the original round trip flight (TO-DO).
(as of December 2022)
- Chrome v108
- Kayak
- TravelMath
- FlightsFrom
First you need to install the required imports:
pip install -r requirements.txt
Here is an example command line input:
python3 flights.py --start JFK --start-date 2023-02-02 --end SFO --end-date 2023-03-03 --alliance ALL
Debugging information will print out, but the main outputs will looks something like this:
PLACES YOU CAN DRIVE TO THEN FLY
Note: If the value is -1, then the price could not be found
{'SMF': 321.4, 'FAT': 339.4, 'SCK': -1, 'STS': -1}
PLACES YOU CAN FLY TO THEN FLY OUT OF
Note: If the value is -1, then the price could not be found
{'Denver': 448.6, 'San Diego': -1, 'Boise': -1, 'Santa Ana': 350.0}
- Stalling when pulling prices. Selenium can be a hit or miss, so just press command + C to skip over that step to the next by providing data manually.
- flights.py - main script
- README.md - this file
- requirements.txt - required imports
- .gitignore - files to ignore when pushing to github
- iata_cities.json - json file of cities and their airport IATA codes
- distances.json - json file of distances between cities and nearby airports
- city_routes.json - json file of routes between cities and nearby airports
- Add test cases
- Add more cities to iata_cities.json
- Prevent same city searches (e.g. LGA to EWR or NYC to NYC)
- Add the ability to filter by airline