-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
41 lines (35 loc) · 1.04 KB
/
Copy pathmain.py
File metadata and controls
41 lines (35 loc) · 1.04 KB
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
import logging
from automation.autosolver import OpenEduAutoSolver
from errors import Unauthorized, GenericOpenEduError, ReloginReceived
from log import setup_logging
from ui.menu import menu_iteration, require_login
version_string = "openedu-auto v1.1"
setup_logging()
logging.debug(version_string)
def main():
print(version_string)
app = OpenEduAutoSolver(None, None)
try:
require_login(app)
except Unauthorized:
print("Не удалось войти")
exit(1)
while True:
try:
if menu_iteration(app):
continue
except GenericOpenEduError as e:
print(e)
return
except Unauthorized as e:
print(e)
return
except ReloginReceived:
print("Сервер сбросил авторизацию")
with app.cache_context:
app.app.logout()
print("Введите пароль заново")
return
break
if __name__ == "__main__":
main()