0

I am trying to use urllib, urllib2 or requests in order to get specific data from a site. I use Python2.7. I keep getting an error:

requests.exceptions.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590)

This is my code with requests:

  import requests
  r = requests.get("https://metoc.ndbc.noaa.gov/jtwc#_48_INSTANCE_0SiamlX2KcM6_=https%3A%2F%2Fmetoc.ndbc.noaa.gov%2FProductFeeds-portlet%2Fimg%2Fjtwc%2Fhtml%2Fcoop.jsp%3F")

I have tried everything but nothing works:

I tried to set the verification parameter to false. I get the same error. I tried to use an adaptor (as described in other answers) in order to use another SSL version. I still get the same error.

Any ideas what can the issue be? Can it be that the host has locked the access and there is no possibility to get the source for this URL?

20
  • 3
    Works for me. I get a bunch of javascript mainly. Commented Jul 6, 2016 at 17:23
  • 1
    @user1919 You get the same sslv3 error explicitly setting tls? The server will not accept any sslv3 even with ECDHE encryption Commented Jul 6, 2016 at 23:02
  • 1
    Maybe a silly question but you did use s to make the request ? i.e the session object? Commented Jul 6, 2016 at 23:07
  • 1
    One last thing what does openssl version output from bash? Commented Jul 6, 2016 at 23:12
  • 1
    it gives this: OpenSSL 0.9.8zh 14 Jan 2016 Commented Jul 6, 2016 at 23:14

1 Answer 1

2

All of them in macs with Yosemite or ElCapitan...

These versions still come with OpenSSL 0.9.8 so my guess is that your python is linked against this version of OpenSSL (python does not use the native TLS stack in OS X). But since the server only supports ECDHE ciphers and these are not supported by OpenSSL 0.9.8 the handshake will fail. See the report from SSLLabs for more details.

Sign up to request clarification or add additional context in comments.

6 Comments

Thanks! So what would be my options here?
@user1919 upgrade your openssl ftp.openssl.org/source
@Padraic Cunningham I have updated my openssl using brew. This didn't solve the issue!
Did you try setting the adapter using tls as per the link I added to the comments?
@user1919: it is not enough to update openssl but it has to be linked with python. To check what version of openssl your python is using check ssl.OPENSSL_VERSION. See stackoverflow.com/questions/18752409/… for more information for how to update your python to include a newer version of openssl.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.