From e28f4a6f0bf6b1bcd70cc016cf47935010af59bb Mon Sep 17 00:00:00 2001 From: dmytrokoren Date: Fri, 15 Nov 2024 10:43:30 -0600 Subject: [PATCH] Set driver option "mobile=True" (#321) Go to check-in page directly instead of homepage. Helps avoid 403/429s more. --- lib/webdriver.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/webdriver.py b/lib/webdriver.py index 65287aa..64651b2 100644 --- a/lib/webdriver.py +++ b/lib/webdriver.py @@ -19,6 +19,7 @@ from .reservation_monitor import AccountMonitor BASE_URL = "https://mobile.southwest.com" +CHECKIN_URL = BASE_URL + "/air/check-in/" LOGIN_URL = BASE_URL + "/api/security/v4/security/token" TRIPS_URL = BASE_URL + "/api/mobile-misc/v1/mobile-misc/page/upcoming-trips" HEADERS_URL = BASE_URL + "/api/mobile-air-booking/v1/mobile-air-booking/feature/shopping-details" @@ -148,15 +149,15 @@ def _get_driver(self) -> Driver: uc_cdp_events=True, undetectable=True, incognito=True, + mobile=True, ) logger.debug("Using browser version: %s", driver.caps["browserVersion"]) driver.add_cdp_listener("Network.requestWillBeSent", self._headers_listener) - logger.debug("Loading Southwest home page (this may take a moment)") - driver.open(BASE_URL) + logger.debug("Loading Southwest check-in page (this may take a moment)") + driver.open(CHECKIN_URL) self._take_debug_screenshot(driver, "after_page_load.png") - driver.click("(//div[@data-qa='placement-link'])[2]") return driver def _headers_listener(self, data: JSON) -> None: