SSLError on HTTPie. Directly using Requests works. #204

edufelipe opened this Issue Feb 21, 2014 · 8 comments

6 participants


I'm getting SSL errors when connecting to some sites using HTTPie. When I manually connect to them using requests the error does not manifest itself.

$ http ''
http: error: SSLError: [Errno bad handshake] [('SSL routines', 'SSL23_GET_SERVER_HELLO', 'sslv3 alert handshake failure')]

$ python
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> r = requests.get('')
>>> r.status_code

$ pip freeze

I'm not seeing an issue:

~ http
Connection: keep-alive
Content-Language: en
Content-Length: 0
Content-Type: text/html; charset=utf-8
Date: Sat, 22 Feb 2014 01:12:01 GMT
Server: nginx/1.1.19
Strict-Transport-Security: max-age=31536000
Vary: Accept-Language

What is the result of: python -c 'import ssl; print(ssl.OPENSSL_VERSION)'?


No problem here either.


Works for me too.

Looks good to SSL Labs too:


@maedox Did you try this from OS X 10.9.2?

$ openssl version
OpenSSL 0.9.8y 5 Feb 2013
$ python -c 'import ssl; print(ssl.OPENSSL_VERSION)'
OpenSSL 0.9.8y 5 Feb 2013

@edufelipe I have the exact same versions and am unable to reproduce it.


I'm closing this for now. Please feel free to reopen if you have some new details.

@jkbrzt jkbrzt closed this Apr 7, 2014

If someone runs into this, performing the following fixes it:

sudo apt-get install libffi-dev
pip install pyOpenSSL ndg-httpsclient pyasn1

kennethreitz/requests#2022 (comment)


I was also having the error not entirely unlike this:

http: error: SSLError: [Errno bad handshake] [('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')]

and google led me here. In my case I just forgot that I had a self-signed certificate, so adding --verify no argument made the call work.

There may be a hidden feature request inside here, namely: Making the error message a bit more human readable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment