Does anyone know why I am getting this error?
SSLError: [Errno 1] _ssl.c:510: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1
I get the erro when using requests or urllib2, I'm running the code on Kodi. The code runs fine when I run it on Visual Studio on my PC.
I am trying to scrape a website that is blocked by my ISP, so I'm using a proxy version of the site.
import requests
url = 'https://kickass.unblocked.pe/'
r = requests.get(url)
The site is hosted by Cloudflare Free SSL and requires support for Server Name Indication (SNI). SNI is support with Python 2.7 only since version 2.7.9. I guess that you are using an older version.
verify=False (which is usually a bad idea anyway) will not help here because without SNI the handshake will fail because the server does not know which certificate is requested and thus will not sent any certificate but instead an alert.
Related
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
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.
I'm using the following code to interact with a Magento webstore using the XMLRPC api. Magento API Python XMLRPC
Everything was working ok until we made a change on our web server to SSL
Now I'm getting the following error.
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)
I'm not sure why the certificate is failing as we have an EV certificate and all browsers are showing this as ok.
My connection string is:
How can I resolve this / over-ride the code
I'm fairly new to Python so please go easy :o)
magento = MagentoAPI("www.website.co.uk", 443, "myUsername", "myPassword", "/api/xmlrpc", True)
Python, or better the OpenSSL library it is using, can not verify the validity of the certificate of the server. There are many possible reasons: bad configuration, missing intermediate or CA certificate, wrong CN...
A first step could be to go to this site and let it test the SSL/TLS capabilities of the server: https://www.ssllabs.com/ssltest/
It will give you hints on how to solve problems as well.
Python verifies certs via its own bundle, check where it is located by
>>> import certifi
>>> certifi.where()
'/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-
packages/certifi/cacert.pem'
and add your certificates to the end of that file.
I am using python-requests to perform get requests to some resources.
In staging and production environments things works out fine, but in the test environment with a slightly different setup, I receive the message below when trying to perform the request:
requests.exceptions.SSLError: [Errno 1] _ssl.c:510: error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac
I have tried using an adapter as specified here: SSL Error on Python GET Request
I have tried all the protocols in the list. Still no luck.
I have tried mounting both the complete url and the domain url. No difference.
Any ideas on what to try next?
Python
I need to request some urls with python. I'm using standard urllib2 procdeure, for instance:
urllib2.urlopen('http://google.com')
Works with no problem. However when using a url that starts with a dash, for instance:
urllib2.urlopen('http://-cityoflove.tumblr.com/')
The script brokes with the error:
urllib2.URLError: <urlopen error [Errno -2] Name or service not known>
Does anyone could thing on a way to get the domain from python?
Ubuntu
If could be help full note that same error is happening with wget:
wget http://-cityoflove.tumblr.com/
That crashes with error:
wget: unable to resolve host address `-cityoflove.tumblr.com'
Note that this error is notified on ubuntu bugs: https://bugs.launchpad.net/ubuntu/+source/resolvconf/+bug/668926
I'm trying to use Python's liburl2 to access the Dreamhost API documented here: http://wiki.dreamhost.com/API
Here is my code:
request = urllib2.Request('https://api.dreamhost.com/?key=<key>')
response = urllib2.urlopen(request)
page = response.read()
print(page)
This invariably fails with the error:
urllib2.URLError: <urlopen error [Errno 104] Connection reset by peer>
I'm absolutely stumped, because I can ping api.dreamhost.com just fine, and wget https://api.dreamhost.com/?key= works fine, too.
Any ideas?
I know it's an old question, but I faced the same problem, and found the solution through two other questions.
This, that shows me the problem is with the handshake using SSLv3:
OpenSSL issues in Debian Wheezy
And this, that gives some possible solutions:
Python HTTPS requests (urllib2) to some sites fail on Ubuntu 12.04 without proxy