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

requests.exceptions.ConnectionError: HTTPSConnectionPool : Pool is Closed (On Some Connections) #24

Closed
Bewinxed opened this issue Jan 28, 2022 · 3 comments
Labels
question Further information is requested

Comments

@Bewinxed
Copy link

Hey man, Amazing module you have here and helped me a lot, I'm getting the following error on "some" requests, any idea how to fix it?

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='', port=443): Pool is closed.`

Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 258, in _get_conn
    conn = self.pool.get(block=self.block, timeout=timeout)
AttributeError: 'NoneType' object has no attribute 'get'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 692, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 261, in _get_conn
    raise ClosedPoolError(self, "Pool is closed.")
urllib3.exceptions.ClosedPoolError: HTTPSConnectionPool(host='1nml8jcdud.execute-api.eu-west-1.amazonaws.com', port=443): Pool is closed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Administrator\OneDrive - hamad.qa\Projects\GuardianGeckoBot\cloudflare.py", line 221, in cloudRequest
    response = await loop.run_in_executor(executor, partial(session.get, url=url, params=params))
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 284, in __await__
    yield self  # This tells Task to wait for completion.
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py", line 328, in __wakeup
    future.result()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\cloudscraper\__init__.py", line 263, in request
    self.perform_request(method, url, *args, **kwargs)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\cloudscraper\__init__.py", line 182, in perform_request
    return super(CloudScraper, self).request(method, url, *args, **kwargs)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\requests_ip_rotator\ip_rotator.py", line 72, in send
    return super().send(request, stream, timeout, verify, cert, proxies)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='', port=443): Pool is closed.
@Ge0rg3
Copy link
Owner

Ge0rg3 commented May 26, 2022

Hi @Bewinxed, really sorry for the delay on this. It looks like this is just a connection issue locally for you, though. Please let me know if this isn't the case? Thanks!

@Ge0rg3
Copy link
Owner

Ge0rg3 commented Oct 7, 2022

Hi @Bewinxed, closing as stale but please let me know if you still need help on this.

@Ge0rg3 Ge0rg3 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2022
@Ge0rg3 Ge0rg3 added the question Further information is requested label Oct 7, 2022
@xloem
Copy link

xloem commented Nov 8, 2022

This appears to be a race condition in the underlying systems that can be worked around by immediately retrying: urllib3/urllib3#951

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

No branches or pull requests

3 participants