byalextran / southwest-headers

IYKYK. 😄
MIT License
30 stars 9 forks source link

undetected-chromedriver needs upgrade. #7

Open CoderFromCali opened 1 year ago

CoderFromCali commented 1 year ago

I just installed this repo but ran into this error:

env/bin/python southwest-headers.py
Traceback (most recent call last):
  File "/root/southwest-headers/southwest-headers.py", line 22, in <module>
    driver = uc.Chrome(headless = True)
  File "/root/southwest-headers/env/lib/python3.10/site-packages/seleniumwire/undetected_chromedriver/webdriver.py", line 61, in __init__
    super().__init__(*args, **kwargs)
  File "/root/southwest-headers/env/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 429, in __init__
    super(Chrome, self).__init__(
  File "/root/southwest-headers/env/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    super().__init__(
  File "/root/southwest-headers/env/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 106, in __init__
    super().__init__(
  File "/root/southwest-headers/env/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 288, in __init__
    self.start_session(capabilities, browser_profile)
  File "/root/southwest-headers/env/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 715, in start_session
    super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session(
  File "/root/southwest-headers/env/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 381, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/root/southwest-headers/env/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "/root/southwest-headers/env/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 249, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:35280
from unknown error: unable to discover open pages
Stacktrace:
#0 0x555f085d5d93 <unknown>
#1 0x555f083a42d7 <unknown>
#2 0x555f083d12f4 <unknown>
#3 0x555f083c82fc <unknown>
#4 0x555f0840d4f4 <unknown>
#5 0x555f08404353 <unknown>
#6 0x555f083d3e40 <unknown>
#7 0x555f083d5038 <unknown>
#8 0x555f086298be <unknown>
#9 0x555f0862d8f0 <unknown>
#10 0x555f0860df90 <unknown>
#11 0x555f0862eb7d <unknown>
#12 0x555f085ff578 <unknown>
#13 0x555f08653348 <unknown>
#14 0x555f086534d6 <unknown>
#15 0x555f0866d341 <unknown>
#16 0x7f89b9533b43 <unknown>

It seems that the undetected-chromedriver v3.1.7 that is specified by this repo is out of sync with the version of google-chrome-stable_current_amd64.deb (v110.0.5481.77-1) that was downloaded when I installed. I was able to fix this by upgrading to undetected-chromedriver v3.4.6 with the command env/bin/pip install undetected-chromedriver --upgrade in the southwest-headers directory.

It may be better not to hard-code the version of undetected-chromedriver in the requirements.txt file if you will be downloading the latest version of google-chrome-stable_current_amd64.deb. Instead, let pipj download the current version of undetected-chromedriver as well.

byalextran commented 1 year ago

good thought about not using explicit versions in the requirements.txt file. i was going to make that change, however, i've had a couple reports of header files working and then all of a sudden not.

in both cases, the reason was because of both had the latest stable version of chrome (v110) and/or package versions. i did some testing on my end and can re-create those results (i.e. errors).

it appears southwest has found a way to detect header files coming from those instances. so the fix was to revert to chrome v109 and the exact package versions in requirements.txt.

for those stumbling on this thread, see the workaround here:

https://github.com/byalextran/southwest-headers/issues/6

carefulcomputer commented 3 months ago

is it possible to package all requirements and dependencies into a docker container ? That will help people who are not very good with python.

byalextran commented 3 months ago

is it possible to package all requirements and dependencies into a docker container ? That will help people who are not very good with python.

it is possible, however, the script doesn't currently work, and i don't have the time to troubleshoot.

right now, i'd recommend you use this working alternative (which has a docker container option):

https://github.com/jdholtz/auto-southwest-check-in/