Pycurl https error: failed to get local issuer certificate

Screenshots of the error

>>> import pycurl >>> c = pycurl.Curl() >>> c.setopt(c.URL, 'https://quora.com') >>> c.perform() Traceback (most recent call last): File "<stdin>", line 1, in <module> pycurl.error: (60, 'SSL certificate problem: unable to get local issuer certificate') >>> >>> c.setopt(c.URL, 'http://quora.com') >>> c.perform() >>> >>> 

Why can't he get a certificate of a local issuer? How can i solve this? When I open quora.com in my browser, I see that its identity is verified. Why is this so? How to get pycurl to use the same certificates that my browser uses? enter image description here

+7
source share
1 answer

The problem is that pycurl requires an updated certificate chain to verify ssl certificates.

A good solution would be to use certifi .

Basically this is a modern copy of mozilla, built into a certificate chain wrapped in a python package that can be updated with pip. certifi.where() indicates the location of the certificate package.

To use pycurl to use, set the CAINFO parameter:

 import pycurl import certifi curl = pycurl.Curl() curl.setopt(pycurl.CAINFO, certifi.where()) curl.setopt(pycurl.URL, 'https://www.quora.com') curl.perform() 
+15
source

All Articles