cli: requests.exceptions.SSLError: [Errno 8] _ssl.c:507: EOF occurred in violation of protocol

HTTPie 1.0.0-dev
HTTPie data: /Users/kaji/.httpie
Requests 2.5.3
Pygments 2.0.2
Python 2.7.6 (default, Sep  9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] darwin
Not every SSL website shows though. So, it is tricky. From browser , it is working fine.

>>> requests.request({'allow_redirects': False,
 'auth': None,
 'cert': None,
 'data': OrderedDict(),
 'files': DataDict(),
 'headers': {'User-Agent': 'HTTPie/1.0.0-dev'},
 'method': 'get',
 'params': ParamsDict(),
 'proxies': {},
 'stream': True,
 'timeout': 30,
 'url': u'https://apissl.example.com',
 'verify': True})

Traceback (most recent call last):
  File "/usr/local/bin/http", line 9, in <module>
    load_entry_point('httpie==1.0.0-dev', 'console_scripts', 'http')()
  File "/Library/Python/2.7/site-packages/httpie/core.py", line 112, in main
    response = get_response(args, config_dir=env.config.directory)
  File "/Library/Python/2.7/site-packages/httpie/client.py", line 41, in get_response
    response = requests_session.request(**kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 461, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/adapters.py", line 431, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 8] _ssl.c:507: EOF occurred in violation of protocol

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 24 (4 by maintainers)

Most upvoted comments

Try

$ pip install --force-reinstall requests[security]

@kajisaap please email me the URL so I can give you better help with this. My email is on my profile page.

I was able to resolve this by doing what @sigmavirus24 suggested

pip install --force-reinstall requests[security] This was with python 2.7.10 on macOS Sierra 10.12

I’m still seeing this:

$ python --version
Python 2.7.11
$ python -c 'import ssl; print(ssl.OPENSSL_VERSION)'
OpenSSL 1.0.2f  28 Jan 2016

I tried force reinstalling requests’ security module: no joy.

@sigmavirus24 sudo pip install --force-reinstall 'requests[security]' --upgrade didnot help. I am in Yosemite 10.10.2 if system information might make the difference