This repository has been archived by the owner on Oct 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcli
executable file
·62 lines (47 loc) · 1.76 KB
/
cli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python
import sys
from datetime import datetime
from controller.controller import Flights as OldFlightsObj
"""README
- this script is to test the functionality without running with Flask
- used to test for controller
"""
class Flights(OldFlightsObj):
"""cli program to test controller"""
def __init__(self):
# initialize variables
self.current_time = datetime.now()
self.data = {} # to store arrival/depart flights
self.airlines = set() # to store airline names
# retrieve latest flights information
self.updateArrival()
print("[+] getting arrival data DONE")
self.updateDeparture()
print("[+] getting departure data DONE")
# show name of airlines
#print(self.getAirlines())
if __name__ == "__main__":
if len(sys.argv) != 3:
exit("./cli [arrival/depart] query")
if sys.argv[1] == 'arrival':
main = Flights()
flights = main.search('arrival', sys.argv[2])
#flights = main.searchByTime("arrival", "Myanmar Airways International", "7pm")
elif sys.argv[1] == 'depart':
main = Flights()
flights = main.search('departure', sys.argv[2])
#flights = main.searchByTime("departure", "Myanmar Airways International", "7pm")
else:
exit("./cli [arrival/depart] query")
print("There are " + str(len(flights)) + " flights.")
if len(flights) > 1:
if main.sameFlightNumbers(flights):
print("Those flights are the same")
else:
print("Those flights are not the same")
"""
if flights != []:
print("Flight {} is scheduled at {}.".format(flights[0].getFlightNo(), flights[0].getScheduled()))
else:
print("Given flight not found")
"""