Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cache/extra_course_data_cache.json
Original file line number Diff line number Diff line change
Expand Up @@ -1062,5 +1062,13 @@
"33337": {
"credits": "1.00",
"prereqs": ""
},
"34975": {
"credits": "1.00 TO 12.00",
"prereqs": ""
},
"34979": {
"credits": "1.00 TO 12.00",
"prereqs": ""
}
}
2 changes: 1 addition & 1 deletion src/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def login_with_drexel_connect(session: Session) -> Session:
# changed easily if the site changes

with sync_playwright() as p:
browser = p.chromium.launch()
browser = p.chromium.launch(headless=True)
context = browser.new_context()
page = context.new_page()
page.goto("https://connect.drexel.edu")
Expand Down
22 changes: 8 additions & 14 deletions src/scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,21 @@ def scrape(
reset_period *= 2
try:
session = login.login_with_drexel_connect(session)
if "shib_idp_session" in session.cookies:
is_logged_into_drexel_connect = True
break
else:
print(
f"shib_idp_session cookie not found in session. Trying again in {reset_period} seconds..."
)
is_logged_into_drexel_connect = True
except Exception:
print("Error logging in to Drexel Connect: ")
# not printing stack trace in case password gets accidentally logged
print(f"Trying again in {reset_period} seconds...")

failiure_count += 1
if failiure_count > 8:
raise Exception(
"Failed to log in to Drexel Connect after {} attempts".format(
failiure_count
failiure_count += 1
if failiure_count > 8:
raise Exception(
"Failed to log in to Drexel Connect after {} attempts".format(
failiure_count
)
)
)

time.sleep(reset_period)
time.sleep(reset_period)

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

Expand Down