requests: TypeError: getresponse() got an unexpected keyword argument 'buffering'

Requests 2.2.1. Same thing happens in 1.2.3 (I upgraded from that).

I get this traceback:

Traceback (most recent call last):
  File "/usr/local/lib/python3.3/site-packages/requests/packages/urllib3/connectionpool.py", line 313, in _make_request
    httplib_response = conn.getresponse(buffering=True)
TypeError: getresponse() got an unexpected keyword argument 'buffering'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.3/site-packages/requests/packages/urllib3/connectionpool.py", line 480, in urlopen
    body=body, headers=headers)
  File "/usr/local/lib/python3.3/site-packages/requests/packages/urllib3/connectionpool.py", line 315, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.3/http/client.py", line 1147, in getresponse
    response.begin()
  File "/usr/local/lib/python3.3/http/client.py", line 358, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.3/http/client.py", line 328, in _read_status
    raise BadStatusLine(line)
http.client.BadStatusLine: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.3/site-packages/requests/adapters.py", line 330, in send
    timeout=timeout
  File "/usr/local/lib/python3.3/site-packages/requests/packages/urllib3/connectionpool.py", line 530, in urlopen
    raise MaxRetryError(self, url, e)
requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='heimdallr.jcea.es', port=443): Max retries exceeded with url: /PANICO (Caused by <class 'http.client.BadStatusLine'>: '')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./heimdallr.py", line 203, in <module>
    module.start()
  File "__main__", line 59, in start
  File "main", line 23, in start
  File "panic_report", line 17, in envia_tb_pendiente
  File "/usr/local/lib/python3.3/site-packages/requests/sessions.py", line 425, in post
    return self.request('POST', url, data=data, **kwargs)
  File "auth_http", line 48, in request
  File "/usr/local/lib/python3.3/site-packages/requests/sessions.py", line 383, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.3/site-packages/requests/sessions.py", line 486, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.3/site-packages/requests/adapters.py", line 378, in send
    raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='heimdallr.jcea.es', port=443): Max retries exceeded with url: /PANICO (Caused by <class 'http.client.BadStatusLine'>: '')
Makefile:69: recipe for target 'run' failed
make: *** [run] Error 1

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 36 (16 by maintainers)

Commits related to this issue

Most upvoted comments

I had the same problem. Fixed by updating requests pip install --upgrade requests

@piyushjajoo No you aren’t. Please read this issue carefully. I made this comment, which linked to this comment from issue #1289. Once again, reproducing the body of the comment:

The key is that the TypeError raised as the first exception is unrelated to the subsequent ones. In fact, that’s the standard control flow in urllib3. This means that the real exception that’s being raised here is the request.exceptions.ConnectionError exception that wraps the urllib3.exceptions.MaxRetryErrorexception being raised in urllib3.

In your case, the real exception you care about is the last one: the ReadTimeoutError. You should pursue that one.