Skip to content

Commit 10ea27c

Browse files
committed
fixed auth issue
1 parent fbecf3b commit 10ea27c

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

cache/extra_course_data_cache.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,5 +1062,13 @@
10621062
"33337": {
10631063
"credits": "1.00",
10641064
"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": ""
10651073
}
10661074
}

src/login.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def login_with_drexel_connect(session: Session) -> Session:
1616
# changed easily if the site changes
1717

1818
with sync_playwright() as p:
19-
browser = p.chromium.launch()
19+
browser = p.chromium.launch(headless=True)
2020
context = browser.new_context()
2121
page = context.new_page()
2222
page.goto("https://connect.drexel.edu")

src/scrape.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,21 @@ def scrape(
2424
reset_period *= 2
2525
try:
2626
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
3428
except Exception:
3529
print("Error logging in to Drexel Connect: ")
3630
# not printing stack trace in case password gets accidentally logged
3731
print(f"Trying again in {reset_period} seconds...")
3832

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+
)
4439
)
45-
)
4640

47-
time.sleep(reset_period)
41+
time.sleep(reset_period)
4842

4943
data: dict[str, dict[str, Any]] = {}
5044

0 commit comments

Comments
 (0)