diff --git a/cache/extra_course_data_cache.json b/cache/extra_course_data_cache.json index 75c29b8..0736613 100644 --- a/cache/extra_course_data_cache.json +++ b/cache/extra_course_data_cache.json @@ -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": "" } } \ No newline at end of file diff --git a/src/login.py b/src/login.py index 4dade21..1a923c4 100644 --- a/src/login.py +++ b/src/login.py @@ -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") diff --git a/src/scrape.py b/src/scrape.py index 018052b..30e18e4 100644 --- a/src/scrape.py +++ b/src/scrape.py @@ -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]] = {}