jdholtz / auto-southwest-check-in

A Python script that automatically checks in to your Southwest flight 24 hours beforehand.
GNU General Public License v3.0
440 stars 84 forks source link

Successful check-in but still got error - can't login with account #129

Closed darryllee closed 1 year ago

darryllee commented 1 year ago

Description

I used the olde undetected-chromedriver for ARMv7 (3.1.0) with olde Chromium 104 and console showed error about too many requests, BUT CHECK-IN was successful (I think).

Do you suppose it's because I'm running such an old version of undetected_chromedriver (3.1.0)? I'd love to run a newer version but don't have the expertise to hack the newer undetected_chromedriver to work with ARMv7.

Thanks!

Output:

Checking in to flight from 'San Jose' to 'Orange County/Santa Ana' for Darryl Lee

Successfully scheduled the following flights to check in for Darryl Lee: Flight from San Jose to Orange County/Santa Ana at 2023-08-01 15:55:00 UTC Flight from Orange County/Santa Ana to San Jose at 2023-08-05 01:05:00 UTC

Failed to check in to flight XXXXXXX for Darryl Lee. Reason: Too Many Requests 429. Check in at this url: https://mobile.southwest.com/check-in

Log:

2023-07-31 08:44:55 DEBUG Process-1:2[checkin_scheduler:50]: Refreshing headers for current session 2023-07-31 08:44:55 DEBUG Process-1:2[webdriver:138]: Starting webdriver for current session 2023-07-31 08:45:04 DEBUG Process-1:2[webdriver:147]: Loading Southwest Check-In page 2023-07-31 08:45:26 DEBUG Process-1:2[webdriver:60]: Filling out a check-in form to get valid headers 2023-07-31 08:45:31 DEBUG Process-1:2[webdriver:201]: Setting valid headers from previous request 2023-07-31 08:45:31 DEBUG Process-1:2[checkin_handler:88]: Sleeping until check-in: 563 seconds... 2023-07-31 08:54:55 DEBUG Process-1:2[checkin_handler:109]: Attempting to check in 2023-07-31 08:54:55 DEBUG Process-1:2[checkin_handler:123]: Making GET request to check in 2023-07-31 08:55:07 DEBUG Process-1:2[utils:34]: Successfully made request after 4 attempts 2023-07-31 08:55:07 DEBUG Process-1:2[checkin_handler:129]: Making POST request to check in 2023-07-31 08:55:23 DEBUG Process-1:2[utils:41]: Failed to make request after 20 attempts: Too Many Requests 429 2023-07-31 08:55:23 DEBUG Process-1:2[utils:44]: Response body: { "code": 429999999, "message": "Error.", "messageKey": "ERROR", "httpStatusCode": "BAD_REQUEST", "requestId": "", "infoList": [] } 2023-07-31 08:55:23 DEBUG Process-1:2[checkin_handler:132]: Failed to check in. Error: Too Many Requests 429. Exiting 2023-07-31 08:55:23 DEBUG Process-1:2[notification_handler:100]: Sending failed check-in notification...

And now I'm trying to log into my account for the return flight, and am seeing too many requests on console:

https://github.com/electron/electron/releases/download/v20.3.8/chromedriver-v20.3.8-linux-arm64.zip /home/pi/.local/share/undetected_chromedriver/chromedriver Encountered a Too Many Requests error while logging in. Skipping reservation retrieval

Log:

2023-07-31 21:22:11 DEBUG MainProcess[log:23]: Initialized the application 2023-07-31 21:22:11 DEBUG MainProcess[main:87]: Called with 2 arguments 2023-07-31 21:22:16 DEBUG MainProcess[config:44]: Reading the configuration file 2023-07-31 21:22:16 DEBUG MainProcess[config:95]: Setting notification level to 1 2023-07-31 21:22:16 DEBUG MainProcess[config:109]: Using 1 notification services 2023-07-31 21:22:16 DEBUG MainProcess[config:121]: Setting retrieval interval to 24 hours 2023-07-31 21:22:16 DEBUG MainProcess[main:105]: Account added through CLI arguments 2023-07-31 21:22:16 DEBUG MainProcess[main:113]: Monitoring 1 accounts and 0 reservations 2023-07-31 21:22:16 DEBUG Process-1[reservation_monitor:133]: Retrieving reservations for account 2023-07-31 21:22:16 DEBUG Process-1[webdriver:138]: Starting webdriver for current session 2023-07-31 21:22:29 DEBUG Process-1[webdriver:173]: An exception occurred when initializing the webdriver: Name: TypeError. Error: 'NoneType' object is not subscriptable 2023-07-31 21:22:29 DEBUG Process-1[webdriver:179]: 2 more attempts 2023-07-31 21:22:40 DEBUG Process-1[webdriver:147]: Loading Southwest Check-In page 2023-07-31 21:23:12 DEBUG Process-1[webdriver:90]: Logging into account to get a list of reservations and valid headers 2023-07-31 21:23:27 DEBUG Process-1[webdriver:226]: Logging in failed for an unknown reason 2023-07-31 21:23:27 WARNING Process-1[reservation_monitor:142]: Encountered a Too Many Requests error while logging in. Skipping reservation retrieval 2023-07-31 21:23:27 DEBUG Process-1[reservation_monitor:94]: Sleeping for 86328 seconds

To Reproduce

  1. Run python southwest.py RESERVATION FIRSTNAME LASTNAME
  2. Run python southwest.py USERNAME PASSWORD

Expected Behavior

Should see a successful checkin. Also successful login and retrieval of upcoming reservation.

Version

Auto-Southwest Check-In v4.3

Additional context

No response

jdholtz commented 1 year ago

Thanks for the detailed write-up. I’ll try later today with the same undetected chromedriver and Chrome v104 today to see if that’s the issue.

How did you get the image to build for ARMv7? I tried on my machine and it took about 20 minutes to build (because it was building a lot of libraries from scratch) and then failed. Edit: Never mind, it doesn't appear you are using Docker.

jdholtz commented 1 year ago

I'm not able to get Chromium v104, but I tried with Undetected Chromedriver 3.1.0 and did not run into any issues. Did you specify the Chrome version as 104 in your config.json? The logs don't seem to indicate that a specific version was set.

darryllee commented 1 year ago

So I was on a Raspberry Pi 4 and just ran:

pip install -U git:https...pathtothearmport

I had previously installed this so maybe that's why it didn't need to rebuild all the libraries, etc.

[For context: After mistakenly upgrading to a newer incompatible version of Chromium a while back, I tried all kinds of hackery like trying to download and extract chromedriver for ARMv7 from Electron and then hardcode a path to it into your code but in the end I found a Pi-Apps script that let me downgrade to a compatible version of Chromium (104)]

Thanks for your great work!! --

--Darryl Lee @.***>

jdholtz commented 1 year ago

My guess is that the undetected chromedriver port you are using is the reason you are being detected by Southwest or . The regular library should work with ARMv7 except for the downloading of the chromedriver. In this case you can download your own (which it appears you already did) and add full path to it in the config.json under chromedriver_path.

darryllee commented 1 year ago

Ooof, sorry I'm being dense. So I have upgraded my Chromium to 109, as I see there is already a "matching" chromedriver. Is this supposed to work with undetected_chromedriver? I do not know.

hi chromium-browser 109.0.5414.112-rpt2 arm64 Chromium web browser, open-source version of Chrome ii chromium-chromedriver 109.0.5414.112-rpt2 arm64 WebDriver driver for the Chromium Browser

I grab the latest undetected_chromedriver by running: pip install git+https://www.github.com/ultrafunkamsterdam/undetected-chromedriver@master # replace @master with @branchname for other branches

I make a copy of /usr/bin/chromedriver -> /home/pi/chromedriver_copy and specify it in config.json:

"chromedriver_path": "/home/pi/chromedriver_copy"

And now... I don't know what's wrong. :-{

$ python southwest.py -v 2023-08-01 21:23:53 DEBUG MainProcess[log:23]: Initialized the application 2023-08-01 21:23:53 DEBUG MainProcess[main:87]: Called with 0 arguments 2023-08-01 21:23:55 DEBUG MainProcess[config:44]: Reading the configuration file 2023-08-01 21:23:55 DEBUG MainProcess[config:137]: Adding 1 accounts from the configuration file 2023-08-01 21:23:55 DEBUG MainProcess[config:66]: Setting check fares to True 2023-08-01 21:23:55 DEBUG MainProcess[config:80]: Setting custom Chromedriver path 2023-08-01 21:23:55 DEBUG MainProcess[config:95]: Setting notification level to 1 2023-08-01 21:23:55 DEBUG MainProcess[config:109]: Using 1 notification services 2023-08-01 21:23:55 DEBUG MainProcess[config:121]: Setting retrieval interval to 24 hours 2023-08-01 21:23:55 DEBUG MainProcess[main:113]: Monitoring 1 accounts and 0 reservations 2023-08-01 21:23:55 DEBUG Process-1[reservation_monitor:133]: Retrieving reservations for account 2023-08-01 21:23:55 DEBUG Process-1[webdriver:138]: Starting webdriver for current session could not detect version_main.therefore, we are assuming it is chrome 108 or higher 2023-08-01 21:23:57 DEBUG Process-1[webdriver:147]: Loading Southwest Check-In page 2023-08-01 21:23:58 DEBUG Process-1[webdriver:90]: Logging into account to get a list of reservations and valid headers Process Process-1: Traceback (most recent call last): File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/home/pi/workplace/auto-southwest-check-in/lib/reservation_monitor.py", line 113, in monitor reservations, skip_scheduling = self._get_reservations() File "/home/pi/workplace/auto-southwest-check-in/lib/reservation_monitor.py", line 137, in _get_reservations reservations = webdriver.get_reservations(self) File "/home/pi/workplace/auto-southwest-check-in/lib/webdriver.py", line 94, in get_reservations WebDriverWait(driver, 30).until( File "/home/pi/.local/lib/python3.9/site-packages/selenium/webdriver/support/wait.py", line 95, in until raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: Stacktrace:

0 0x00558907ff44

1 0x005588e6b4cc

2 0x005588ea0cd0

3 0x005588ed4c0c

4 0x005588e95bfc

5 0x005588e96c08

6 0x0055890cb27c

7 0x0055890cd93c

8 0x0055890cdf8c

9 0x0055890b63e4

10 0x0055890ce6a8

11 0x0055890a8b6c

12 0x0055890ec288

13 0x0055890ec408

14 0x005589106110

15 0x007f95143648 start_thread

16 0x007f94c6ec1c

darryllee commented 1 year ago

For good measure I upgraded to Chromium 113 and had the same problems with a slightly different stacktrace:

hi chromium-browser 113.0.5672.95-rpt1 arm64 Chromium web browser, open-source version of Chrome ii chromium-chromedriver 113.0.5672.95-rpt1 arm64 WebDriver driver for the Chromium Browser

Errors - hum. Maybe I need to maybe clean install selenium, et al.

selenium.common.exceptions.TimeoutException: Message: Stacktrace:

0 0x00557635a088

1 0x0055760c9808

2 0x0055760fee70

3 0x0055761321c4

4 0x0055760f4aa8

5 0x0055760f5a04

6 0x005576320aec

7 0x0055763236b0

8 0x005576323c88

9 0x00557632b6e4

10 0x0055763242dc

11 0x0055762feda0

12 0x005576342e98

13 0x005576343028

14 0x0055763526c4

15 0x007f95cf7648 start_thread

16 0x007f95822c1c

darryllee commented 1 year ago

GAH. OK! Ran pip install -r requirements.txt and it downgraded from undetected-chromedriver-3.5.0 to 3.1.7

And it ran without errors!

So for anyone else, THIS WORKED on Debian GNU/Linux 11 (bullseye) on a Raspberry Pi 4:

With these packages installed:

Copy the chromedriver binary so it can be patched by undetected_chromedriver: cp /usr/bin/chromedriver /home/pi/chromedriver_copy

Specify the location of the chromedriver in json.config: "chromedriver_path": "/home/pi/chromedriver_copy"

WOOT! (Well, we'll see if I get checked in on Thursday night. :-)

jdholtz commented 1 year ago

Good to hear! Currently, this script only works with undetected chromedriver up to 3.4.7. It doesn’t work with version 3.5.0 due to Selenium Wire, but I made a pull request to fix it. That might take a while to be merged, however, because that project is not currently active.

jdholtz commented 1 year ago

Hey @darryllee, was the check in successful on your Raspberry Pi?

darryllee commented 1 year ago

Yes! Got the notification and everything!!

On Fri, Aug 4, 2023 at 8:16 PM Joey Holtzman @.***> wrote:

Hey @darryllee https://github.com/darryllee, was the check in successful on your Raspberry Pi?

— Reply to this email directly, view it on GitHub https://github.com/jdholtz/auto-southwest-check-in/issues/129#issuecomment-1666369212, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANODJSIZ6TULWIXREZMLPDXTW3HNANCNFSM6AAAAAA27GEJAE . You are receiving this because you were mentioned.Message ID: @.***>

--

--Darryl Lee @.***>

jdholtz commented 1 year ago

Nice! I’ll point anyone with a similar setup to this issue in the future. Thanks for taking your time to test and outline the process.