-
Notifications
You must be signed in to change notification settings - Fork 0
/
dump.py
112 lines (99 loc) · 2.84 KB
/
dump.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# -*- coding: utf-8 -*-
from app_controller.auth import Authenticator
from app_controller.calendar_exporter import CalendarExporter
from app_controller.course_browser import CourseBrowser
from app_controller.downloader import Downloader
from app_controller.dumper import dump4mock
from app_controller.grades_reporter import GradesReporter
def dump_auth():
global username
global password
with Authenticator(
username,
password,
max_len=100,
max_age=30,
filepath=__file__,
verbose=True,
) as handler:
handler.sign_in()
def dump_calendar_exporter():
global username
global password
with CalendarExporter(
username,
password,
max_len=100,
max_age=30,
filepath=__file__,
verbose=True,
) as handler:
handler.sign_in()
handler.export_calendar()
def dump_course_browser():
global username
global password
with CourseBrowser(
username,
password,
max_len=100,
max_age=30,
filepath=__file__,
verbose=True,
) as handler:
handler.sign_in()
for course in handler.list_courses():
handler.list_course_resources(int(course["id"]))
handler.get_booking_id()
passed_modules, passed_subjects = handler.get_graded_records()
entries = handler.get_curricullum_entries(set(), set())
entries = handler.create_booking_context(entries)
handler.update_enrolled_course_modules(entries)
entries = handler.get_curricullum_entries(passed_modules, passed_subjects)
entries = handler.create_booking_context(entries)
handler.update_enrolled_course_modules(entries)
handler.get_dependency_graph()
handler.get_available_credits()
handler.get_courses_to_register()
def dump_downloader():
global username
global password
handler = Downloader(
username,
password,
max_len=100,
max_age=30,
filepath=__file__,
verbose=True,
)
handler.download("https://www.example.com")
def dump_grades_reporter():
global username
global password
with GradesReporter(
username,
password,
max_len=100,
max_age=10,
filepath=__file__,
verbose=True,
) as handler:
handler.sign_in()
handler.get_grades()
if __name__ == "__main__":
username = input("enter your username, please: ")
password = input("enter your password, please: ")
dump4mock.DUMP_CLASS = [
Authenticator,
CalendarExporter,
CourseBrowser,
Downloader,
GradesReporter,
]
dump4mock(dump4mock.DUMP_CLASS)
print(dump4mock.MOCK_DIR)
dump_auth()
dump_calendar_exporter()
dump_course_browser()
dump_downloader()
dump_grades_reporter()