Timeout not working for "requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))"

I'm making calls to an API and multiple times a day requests hangs then throws `'Remote end closed connection without response'` after 1-2 minutes even with the timeout set to 3 seconds.

## Expected Result

I would expect it to timeout after 3 seconds.

## Actual Result
`Time elpased (hh:mm:ss.ms) 0:01:55.254653`
```
  File "/home/vmagent/app/checker/views.py", line 127, in call_api
    return sessions[region].get(url, timeout=3)
  File "/env/lib/python3.6/site-packages/requests/sessions.py", line 521, in get
    return self.request('GET', url, **kwargs)
  File "/env/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/env/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/env/lib/python3.6/site-packages/requests/adapters.py", line 490, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
```

## Reproduction Steps

```
import datetime
import traceback

from requests import session, Timeout

from checker.forms import REGIONS

sessions = {}
for r in REGIONS:
    sessions[r] = session()
    sessions[r].headers.update({'X-API-KEY': 'API-KEY-#####'})


def call_api(url, region):
    start_time = datetime.datetime.now()
    try:
        return sessions[region].get(url, timeout=3)
    except Timeout:
        time_elapsed = datetime.datetime.now() - start_time
        print('Time elpased (hh:mm:ss.ms) {}'.format(time_elapsed))
        return 408  # Timeout
    except:
        time_elapsed = datetime.datetime.now() - start_time
        print('Time elpased (hh:mm:ss.ms) {}'.format(time_elapsed))
        traceback.print_exc()
        return 520  # Unknown error
```

## System Information

```
pip==9.0.1
mysqlclient==1.3.12
Django==2.0rc1
django-db-geventpool==1.21
django-removewww==0.1.2
gevent==1.2.2
gunicorn==19.7.1
psycopg2==2.7.3.2
python-dateutil==2.6.1
pytz==2017.3
regex==2017.11.9
requests-toolbelt==0.8.0
requests[security]
six==1.11.0
wheel==0.30.0
```

{
  "chardet": {
    "version": "3.0.4"
  },
  "cryptography": {
    "version": "2.1.4"
  },
  "idna": {
    "version": "2.6"
  },
  "implementation": {
    "name": "CPython",
    "version": "3.6.3"
  },
  "platform": {
    "release": "10",
    "system": "Windows"
  },
  "pyOpenSSL": {
    "openssl_version": "1010007f",
    "version": "17.4.0"
  },
  "requests": {
    "version": "2.18.4"
  },
  "system_ssl": {
    "version": "100020bf"
  },
  "urllib3": {
    "version": "1.22"
  },
  "using_pyopenssl": true
}

I think there's a misunderstanding here that would be clarified by reviewing our [documentation](http://docs.python-requests.org/en/master/user/quickstart/#timeouts)

Specifically our Note (emphasis mine):

> `timeout` is **not a time limit on the entire response** download; rather, an exception is raised if the server has not issued a response for timeout seconds (more precisely, if no bytes have been received on the underlying socket for `timeout` seconds). If no timeout is specified explicitly, requests do not time out.

In other words, the server is tricking your socket into thinking that it's getting data once every ~3 seconds (and connecting takes < 3 seconds) so this is why you see a ConnectionError after almost 2 minutes. If you want a time limit on the entire response (also known as a wall timeout) you'll need to use a different approach that works for your target operating system. There are packages on PyPI that accomplish this through many different means based on the target operating system.

Cheers,
Ian

P.S.

This topic has been covered in depth in many other issues. Please review those in the future before opening new issues.

What is the best way for searching for these issues? I've been Google searching this error message for the past 2 days and haven't found anything relating to what you've told me.

GitHub's issue search is pretty good. Here's what I looked for: https://github.com/requests/requests/issues?utf8=%E2%9C%93&q=is%3Aissue+timeout+wall

For reference https://github.com/requests/requests/issues/3099 pops up in that search which has back references to many other issues discussing this as well.

And there's more discussion of packages on https://github.com/requests/toolbelt/issues/51