If you've ever planned a holiday where the start and end date are not fixed,
you may have gone crazy trying to find the best flights from all combinations
Fret no more!
Using the SkyScanner API, you can get get all flights from a range of dates
and collect them in a single spreadsheet.
SkyScanner is a great resources, but checking many combinations is cumbersome. This tool automates querying the Skyscanner API and displays all the information condensed in a single spreadsheet.
- Python >= 3.7
- R >= 4.0
- A RapidAPI account subscribed to the 3B Data SkyScanner API
For the python dependencies, run from the terminal:
pip install requests python-dotenv python-dateutil pyyaml
For the R ones, start an R session and run
install.packages("tidyverse")
install.packages("yaml")
- Go to the RapidAPI website
- Sign up by creating an account or using OAuth
- Head to the 3B Data SkyScanner API and subscribe (free tier is enough)
- Now go to the 'Endpoints' tab and copy the default value of the
X-RapidAPI-Key
- Create a
.env
file and copy the following line changing the value of theRAPIDAPI_SKYSCANNER_KEY
field to the value you just copied
RAPIDAPI_SKYSCANNER_KEY=<your_api_key>
Once you have all the packages and a API Key in your .env
file, you need to edit params.yaml
to specify the parameters of your search. The file provided has as an example a query I used to get home for Christmas.
First specify the locations:
from
: the IATA code of the airport you're leaving fromto
: the IATA code of the airport you're travelling to
Then the dates:
- The range of starting dates must be specified in the
start_date_first
andstart_date_last
fields, respectively - For the return dates, the same applies, but the fields are
end_date_first
andend_date_last
Then run from the terminal
bash get_me_home.sh
The results will be stored in a CSV file in the out
folder called flights_XX.csv
(depending on how many files are there already).
Optional parameters:
- You can specify the location where JSON files are stored in the
json_dir
field
The script will check all combinations, query the Skycanner API to get all possible flights for that combination of flights and store the results in JSON files. An R script then parses all JSON files and exports the merged info in an Excel file sorted by price in ascending order.
- Standard README template from the Documentation Compendium