Forums

Selenium: Max retries exceeded with url

Hi,

I'm trying to scrape from a website (paid Hacker account) and getting the following error:

urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=48451): Max retries exceeded with url: /session/4a0816a71d25614a81f82b571d6cc92c/source (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd2e1df3f40>: Failed to establish a new connection: [Errno 111] Connection refused'))

I can run the code locally no problems and never get a connection refused error, no matter how often I run it.

Are certain sites blocked? I'm new to pythonanywhere.

It doesn't look like a selenium error to me; your code tries to connect to the localhost and fails. Could you show us the relevant part of your code (or at least the full traceback message)?

I got this working but I'm having trouble accessing a 2nd site through Selenium Chromedriver. I keep getting a "Unrecoverable error" when I screenshot the Chromedriver. Could it be that this particular site is blocking PythonAnywhere from scraping? The code is working now as the first site scrapes successfully.

If it's working for one site and not another, that suggests that it's something about the second site that is causing it. It could be that the site is blocking scraping from PythonAnywhere.