-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
89 lines (81 loc) · 1.9 KB
/
run.py
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import argparse
import backend as bc
manager = bc.Manager()
parser = argparse.ArgumentParser(
description="Program for working with ship Internet"
)
parser.add_argument(
"-pm",
"--price_monitor",
action="store_true",
help="Write argument -pm or --price_monitor if you want monitor price."
" If you get value equal 0,45$, sound will be started",
)
parser.add_argument(
"-c", "--connect", action="store_true", help="You will connect to internet"
)
parser.add_argument(
"-sp",
"--set_password",
type=str,
help="Set your password. It will keep in separate file",
)
parser.add_argument(
"-su",
"--set_user",
type=str,
help="Set your user_name. It will keep in separate file",
)
parser.add_argument(
"-d",
"--disconnect",
action="store_true",
help="It will disconnect internet"
)
parser.add_argument(
"-rt",
"--remaining",
action="store_true",
help="It will check remaining time"
)
parser.add_argument(
"-cp",
"--check_price",
action="store_true",
help="It will print price for internet"
)
args = parser.parse_args()
def analyze(
price_monitor=False,
connect=False,
set_password=None,
set_user=None,
disconnect=False,
remaining=False,
check_price=False,
):
if price_monitor:
manager.price_monitor()
if connect:
manager.connect()
if disconnect:
manager.disconnect()
if remaining:
manager.check_remaining()
if set_user is not None:
manager.set_user(set_user)
if set_password is not None:
manager.set_password(set_password)
if check_price:
print(manager.price_check())
manager.driver.close()
if __name__ == "__main__":
analyze(
args.price_monitor,
args.connect,
args.set_password,
args.set_user,
args.disconnect,
args.remaining,
args.check_price,
)