If you are trying to make a https connection using httplib2.Http to a server which uses self-signed certificate, you might face "httplib2.SSLHandshakeError: [Errno 1] _ssl.c:480: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed".
There are 2 solutions:
1. httplib2.Http(disable_ssl_certificate_validation=True).request('https://www.godaddy.com/')
2. httplib2 uses its own certificate store. Usually, the location would be python/httplib2/cacerts.txt.
Edit this file to add the certificate of your server and you should be good to go.
4 comments:
hey,
how can I obtain server certificate if I don't have local access to the server?
@padre
Sorry for the late reply.
I think there is some Java tool which lets you hit the URL and shows you the certificate. You can then copy the contents and save it to a file.
Don't remember the Java tool name.
Also, look into using the 0.8.0devN at https://bitbucket.org/jaraco/httplib2/ which contains a more up to date (and much larger) certs.txt generated from this script: https://bitbucket.org/jaraco/httplib2/src/1faf477eb2d7/certs.py
A reference to my blog: http://fijiaaron.wordpress.com/2011/09/15/testing-rest-web-services-with-python/
Glad to be of help to people! :)
Post a Comment