File tree Expand file tree Collapse file tree 3 files changed +17
-15
lines changed Expand file tree Collapse file tree 3 files changed +17
-15
lines changed Original file line number Diff line number Diff line change 1062
1062
"33337" : {
1063
1063
"credits" : " 1.00" ,
1064
1064
"prereqs" : " "
1065
+ },
1066
+ "34975" : {
1067
+ "credits" : " 1.00 TO 12.00" ,
1068
+ "prereqs" : " "
1069
+ },
1070
+ "34979" : {
1071
+ "credits" : " 1.00 TO 12.00" ,
1072
+ "prereqs" : " "
1065
1073
}
1066
1074
}
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ def login_with_drexel_connect(session: Session) -> Session:
16
16
# changed easily if the site changes
17
17
18
18
with sync_playwright () as p :
19
- browser = p .chromium .launch ()
19
+ browser = p .chromium .launch (headless = True )
20
20
context = browser .new_context ()
21
21
page = context .new_page ()
22
22
page .goto ("https://connect.drexel.edu" )
Original file line number Diff line number Diff line change @@ -24,27 +24,21 @@ def scrape(
24
24
reset_period *= 2
25
25
try :
26
26
session = login .login_with_drexel_connect (session )
27
- if "shib_idp_session" in session .cookies :
28
- is_logged_into_drexel_connect = True
29
- break
30
- else :
31
- print (
32
- f"shib_idp_session cookie not found in session. Trying again in { reset_period } seconds..."
33
- )
27
+ is_logged_into_drexel_connect = True
34
28
except Exception :
35
29
print ("Error logging in to Drexel Connect: " )
36
30
# not printing stack trace in case password gets accidentally logged
37
31
print (f"Trying again in { reset_period } seconds..." )
38
32
39
- failiure_count += 1
40
- if failiure_count > 8 :
41
- raise Exception (
42
- "Failed to log in to Drexel Connect after {} attempts" .format (
43
- failiure_count
33
+ failiure_count += 1
34
+ if failiure_count > 8 :
35
+ raise Exception (
36
+ "Failed to log in to Drexel Connect after {} attempts" .format (
37
+ failiure_count
38
+ )
44
39
)
45
- )
46
40
47
- time .sleep (reset_period )
41
+ time .sleep (reset_period )
48
42
49
43
data : dict [str , dict [str , Any ]] = {}
50
44
You can’t perform that action at this time.
0 commit comments