Ocirne
Ocirne

Reputation: 323

SSL error using python(2.7) requests

I am unable to issue a request to piratebay using requests with python2.7. I did the same with python3.4 and it worked ok. The line which I'm trying to execute:

r = requests.get("http://thepiratebay.se/browse/201", verify=False)

I did the verify=False to try and escape all the SSL jargon to no avail. It's a small personal project anyway..

I also tried to change the version of SSL using this link, however it still is giving me

requests.exceptions.SSLError: [Errno 1] _ssl.c:510: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error.`

Thanks

Upvotes: 3

Views: 1257

Answers (1)

Steffen Ullrich
Steffen Ullrich

Reputation: 123531

The site thepiratebay.se requires Server Name Indication (SNI) and will throw an alert if the client does not support it. While python3 supported SNI for a while already with python2.7 SNI was only added with version 2.7.9. My guess is that you are using an older version of python 2.7 and that's why run into this error.

Upvotes: 2

Related Questions