Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 855
Ocirne Avatar asked Jan 21 '26 06:01

Ocirne


1 Answers

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.

like image 167
Steffen Ullrich Avatar answered Jan 23 '26 18:01

Steffen Ullrich



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!