Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f5abcb3c5d0>: Failed to establish a new connection: [Errno 110] Connection timed out #251

Open
avatar-lavventura opened this issue Nov 1, 2020 · 1 comment

Comments

@avatar-lavventura
Copy link

avatar-lavventura commented Nov 1, 2020

I am trying to connect into owncloud using following script, where I am storing oc object into a file ; and re-use the same one.

oc = owncloud.Client("https://b2drop.eudat.eu/")
with open(password_path, "r") as content_file:
    password = content_file.read().strip()

oc.login(user, password)  # May take long time to connect
password = ""
f = open(foc_object_path, "wb")
pickle.dump(oc, f)
f.close()

During my tests this works but when I run the same script over and over again I may get following error:

  File "/home/alper/venv/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/home/alper/venv/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/home/alper/venv/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/alper/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/home/alper/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 381, in _make_request
    self._validate_conn(conn)
  File "/home/alper/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 976, in _validate_conn
    conn.connect()
  File "/home/alper/venv/lib/python3.7/site-packages/urllib3/connection.py", line 308, in connect
    conn = self._new_conn()
  File "/home/alper/venv/lib/python3.7/site-packages/urllib3/connection.py", line 172, in _new_conn
    self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f5abcb3c5d0>: Failed to establish a new connection: [Errno 110] Connection timed out

=> Is there any way to prevent this error to happening ?

@luffah
Copy link

luffah commented Apr 15, 2021

IMHO the reject is done by the server, therefore it doesn't really have its place in bugs.

Best way would be to proxy the connection, to limit logins... or maybe there is another way .. like making a share link and downloading with <share url>/download.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants