Hey, I am trying to run a python script, and running headless Selenium gives me the following error:
Message: unknown error: net::ERR_TUNNEL_CONNECTION_FAILED
However, it works fine on my local computer. What can I do to fix this error?
Hey, I am trying to run a python script, and running headless Selenium gives me the following error:
Message: unknown error: net::ERR_TUNNEL_CONNECTION_FAILED
However, it works fine on my local computer. What can I do to fix this error?
What is the code causing that error?
This is the stacktrace I am getting on the exception.
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2051, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1501, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/site-packages/flask_restful/__init__.py", line 271, in error_router
return original_handler(e)
File "/home/SoftinfoSystems/.local/lib/python3.9/site-packages/flask_cors/extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1499, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1485, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/home/SoftinfoSystems/WizClipBot2/app.py", line 19, in get
screenshot = messenger.login()
File "/home/SoftinfoSystems/WizClipBot2/whatsapp.py", line 74, in login
self.browser.get(self.BASE_URL)
File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
self.execute(Command.GET, {'url': url})
File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_TUNNEL_CONNECTION_FAILED
(Session info: headless chrome=90.0.4430.212)
**NO MATCH**
I think the error is on the line where I run self.browser.get(self.BASE_URL)
, where self.BASE_URL = 'https://web.whatsapp.com/'
. Something about that is causing this tunnel connection failure?
Free accounts have restricted internet access on PythonAnywhere. If you want to scrape, you need to upgrade.
That makes sense. We actually wanted to upgrade anyway, but I wanted to test the app to make sure it is working before upgrading. But since you have a refund policy, I think we will upgrade our account soon. Thanks for letting me know.
Great! Just let us know if you have any problems.