Python OAuth2 failing with X509 error# Mon Feb 9, 2015 by brett
I’ve just spent about 20 minutes trying to authenticate with Twitter using the Python OAuth2 module. I kept on getting an X509 error, specifically:
ssl.SSLError: [Errno 185090050] _ssl.c:343: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
The solution to this is that the cacerts.txt file in the Python installation is only readable to the root user / wheel group. In order to fix that up, first find the cacerts.txt file:
find /Library/Python/ -name cacerts.txt
Then modify the permissions on the file:
sudo chmod 644 /Library/Python//2.7/site-packages/httplib2-0.7.7-py2.7.egg/httplib2/cacerts.txt
Note that the URL endpoints for twitter on the python-oauth2 Github page are currently wrong. To use the “Twitter Three-legged OAuth Example” change http://twitter.com/oauth/request_token to https://api.twitter.com/oauth/request_token, etc.