FLIGHT PRICES TRACKER
PURPOSE: Return cheapest flight from the Skyskanner using custom parameters (city from/to, date etc.)
PREREQUISITES (for running on own machine):
- Up and running MongoDB server (db and collection created automatically if missing)
- Created general API key on rapidapi.com (https://docs.rapidapi.com/docs/keys)
- Created 'config_private_keys.py' Content: rapidapi_key = "SECRET_API_KEY"
- Installed libraries:
- pymongo
- colorama
- send2trash
- json
- sys
- requests
- bson
- logging
HOW TO RUN:
- Change parameters in config.py to custom if needed
- Run runner.py
PROGRAM MODE: Generally program can be run in either mode:
- Live API - up to date latest data from Skyskanner (https://skyscanner.github.io/slate/#flights-live-prices). It's more time and resource consuming, returns ALL flights for the passed parameters.
- Browse Quotes - flight with min price from the Skyskanner cache (https://skyscanner.github.io/slate/#browse-quotes) It runs much faster than previous call, returns 1 flight with min price for the passed parameters. To chose mode, please set 'live_api_mode' to True or False.
PROCESS FLOW:
- Get airport city ids from city names (departure & destination)
- Create Live Pricing Service Session (it should be created before requesting Live price data) and get results from Live API OR get results from Browse Quotes
- Record JSON into MondoDB
- Retry if process fails at any of the points above
- Record JSON into file if passed respective flag (for test purposes)
- Repeat process for N days (pickle date in case process was interrupted, so it's possible to continue where it left off)
- Find cheapest flight (or with price lower than threshold for Live API)