It is a command-line utility and slack bot developed in python where user can either run it using command line or can run /slash commands by deploying it. This project uses OpenSky REST API and Paytm Flight API.
- Clone the repository and navigate to
flight-tracker
directory.
git clone https://github.com/vipin0/filght-tracker.git
- Install the required dependencies.
pip install -r requirements.txt
- Run it as a command-line application.
python flight_tracker.py -a 'LKO'
- Clone the repository and navigate to
flight-tracker
directory.
git clone https://github.com/vipin0/filght-tracker.git
- Install the required dependencies.
pip install -r requirements.txt
- It's takes the following environment variables, create a file
.env
with the content of.env.sample
.
SLACK_BOT_TOKEN=your-bot-token
SLACK_SIGNING_SECRET=your-signing-secret
PORT=4444
- Start the development server.
python slack_bot.py
- /get_flights origin_code destination_code [YYYY-MM-DD] [no_passengers] [travel_class]
This command list all the flights between given airports on gievn date.
You must provide origin airport code and destination airport code.
Default search date to today's date.
Default no_passengers is 1
Default travel_class is 'E' or you can use 'B'.
- /list_arrivals airport_code [begintime] [endtime]
This list all the flights arriving on the given airports.
- /list_departures airport_code [begintime] [endtime]
This list all the flights departing from the given airports.
- /help
This command show the help menu for the bot.
Usage:
$ python flight_tracker.py [OPTIONS] AIRPORT_CODE
Options:
-a, --arrival list the arriving airplanes to the given airport.
-d, --depart list the depaturting airplanes from the given
airport.
-b, --begin [%Y-%m-%d] starting date in Y-m-d i.e. 2021-12-12
-e, --end [%Y-%m-%d] ending date in Y-m-d i.e. 2021-12-12
--help Show this message and exit.
By default the script show all the airplanes within the time interval of last 24 hours
.
Changing time interval
Use -b/--begin or -e/--end for changing date.
Example
$ python flight_tracker.py -a LKO -b 2021-10-30 -e 2021-11-02
or
$ python flight_tracker.py -a LKO --begin 2021-10-30 --end 2021-11-02
Arrivals
Use -a or --arrival flag to list all the arriving airplanes.
Example
$ python flight_tracker.py -a LKO
Departures
Use -a or --arrival flag to list all the departing airplanes.
Example
$ python flight_tracker.py -d LKO
This project is uses the following third-party dependencies.
slackclient
slackeventsapi
flask
requests
click
tabulate
To run the testcases run the following.
pytest test_flight.py