coolsarne / TicketswapBot

Bot that checks and reserves tickets. Written in python and selenium.
16 stars 13 forks source link

ValueError: Timeout value connect was <object object at 0x0000022743F38820>, but it must be an int, float or None. #2

Open kenjibailly opened 1 year ago

kenjibailly commented 1 year ago

Does this bot still work? If it does, why am I getting this error?

I don't know what format the "twilioPhone" and "phone" in the settings.json file want. I tried without the "+" and with "00" in front, but I'm not sure if the error comes from these fields.

Traceback (most recent call last):
  File "C:\Users\kenji\Documents\ticketswap\TicketswapBot\main.py", line 54, in <module>
    main()
  File "C:\Users\kenji\Documents\ticketswap\TicketswapBot\main.py", line 17, in main
    bot = Bot(ticket["magicLink"].strip())
  File "C:\Users\kenji\Documents\ticketswap\TicketswapBot\bot.py", line 11, in __init__
    self.webdriver = WebDriver()
  File "C:\Users\kenji\Documents\ticketswap\TicketswapBot\webdriver.py", line 14, in __init__
    self.driver = webdriver.Chrome(
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\chrome\webdriver.py", line 76, in __init__
    RemoteWebDriver.__init__(
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 319, in execute
    response = self.command_executor.execute(driver_command, params)
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\remote\remote_connection.py", line 374, in execute
    return self._request(command_info[0], url, body=data)
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\remote\remote_connection.py", line 397, in _request
    resp = self._conn.request(method, url, body=body, headers=headers)
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\_request_methods.py", line 118, in request
    return self.request_encode_body(
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\_request_methods.py", line 217, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\poolmanager.py", line 432, in urlopen
    conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme)
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\poolmanager.py", line 303, in connection_from_host
    return self.connection_from_context(request_context)
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\poolmanager.py", line 328, in connection_from_context
    return self.connection_from_pool_key(pool_key, request_context=request_context)
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\poolmanager.py", line 351, in connection_from_pool_key
    pool = self._new_pool(scheme, host, port, request_context=request_context)
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\poolmanager.py", line 265, in _new_pool
    return pool_cls(host, port, **request_context)
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\connectionpool.py", line 196, in __init__
    timeout = Timeout.from_float(timeout)
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\util\timeout.py", line 190, in from_float
    return Timeout(read=timeout, connect=timeout)
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\util\timeout.py", line 119, in __init__
    self._connect = self._validate_timeout(connect, "connect")
  File "C:\Users\kenji\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\util\timeout.py", line 156, in _validate_timeout
    raise ValueError(
ValueError: Timeout value connect was <object object at 0x0000022743F38820>, but it must be an int, float or None.
coolsarne commented 1 year ago

I made this bot a year ago during summer break, right now I'm graduated and mostly focusing on work. I will soon try to find some time to test if the bot still works and update my code+documentation.

Vanderlane commented 1 year ago

Unfortunately same error. Too bad, hoped i could use it!

RNSKNP commented 1 year ago

I made this bot a year ago during summer break, right now I'm graduated and mostly focusing on work. I will soon try to find some time to test if the bot still works and update my code+documentation.

This would be great! Keep us updated :)

Praesklepios commented 11 months ago

It's caused by an incompatibility between a new urllib version and the chosen selenium version in requirements. See stackoverflow discussion.

While this error is easily fixed by bumping selenium, it will lead to other errors with new function naming from selenium's side. Fixing that (by replacing "find_element_by_xpath" in bot.py and search for english xpath instead of dutch one as TicketSwap changed the wording) will still not make it work as Ticketswap will let you run into human-user authentification within a few requests.

From there I'd assume you'll need to open new sessions continuously, throttle the time between requests or in the worst case switch IPs between requests. You can also no longer reserve a ticket without being logged in, so yeah things became more complicated in 2023.