Skip to content

Commit 7ed1528

Browse files
committed
add ssoToken check to avoid repetitive login
1 parent 114bf38 commit 7ed1528

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ venv
99
__pycache__
1010
.DS_Store
1111
.vscode
12+
.session

find_breadths.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ def save_electives(args):
2323
session = requests.Session()
2424

2525
if args.notp:
26-
sessionToken, ssoToken = erp.login(headers, session, ERPCREDS=erpcreds, LOGGING=True)
26+
erp.login(headers, session, ERPCREDS=erpcreds, LOGGING=True, SESSION_STORAGE_FILE=".session")
2727
else:
28-
sessionToken, ssoToken = erp.login(headers, session, ERPCREDS=erpcreds, OTP_CHECK_INTERVAL=2, LOGGING=True)
28+
erp.login(headers, session, ERPCREDS=erpcreds, OTP_CHECK_INTERVAL=2, LOGGING=True, SESSION_STORAGE_FILE=".session")
29+
2930

3031
ERP_ELECTIVES_URL = "https://erp.iitkgp.ac.in/Acad/central_breadth_tt.jsp"
3132

@@ -37,13 +38,6 @@ def save_electives(args):
3738
rows = soup.find_all('tr')
3839

3940
courses = []
40-
# course_codes = []
41-
# course_names = []
42-
# credits = []
43-
# prereqs = []
44-
# venues = []
45-
# depts = []
46-
# slots = []
4741

4842
for row in rows:
4943
# Extract the data within the 'td' tags

find_depths.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ def save_depths(args):
3434
session = requests.Session()
3535

3636
if args.notp:
37-
sessionToken, ssoToken = erp.login(headers, session, ERPCREDS=erpcreds, LOGGING=True)
37+
erp.login(headers, session, ERPCREDS=erpcreds, LOGGING=True, SESSION_STORAGE_FILE=".session")
3838
else:
39-
sessionToken, ssoToken = erp.login(headers, session, ERPCREDS=erpcreds, OTP_CHECK_INTERVAL=2, LOGGING=True)
39+
erp.login(headers, session, ERPCREDS=erpcreds, OTP_CHECK_INTERVAL=2, LOGGING=True, SESSION_STORAGE_FILE=".session")
4040

4141
TIMETABLE_URL = f"https://erp.iitkgp.ac.in/Acad/view/dept_final_timetable.jsp?action=second&course={args.dept}&session={args.session}&index={args.year}&semester={args.semester}&dept={args.dept}"
4242
SUBJ_LIST_URL = f"https://erp.iitkgp.ac.in/Acad/timetable_track.jsp?action=second&dept={args.dept}"

0 commit comments

Comments
 (0)