错误:pycurl.error: (60, 'SSL certificate problem: self signed certificate in certificate chain')解决方案

十点数据 1月前 ⋅ 95 阅读

The problem is that pycurl needs an up-to-date certificate chain to verify the ssl certificates.

A good solution would be to use certifi.

It's basically an up-to-date copy of mozilla's built in certificate chain wrapped in a python package which can be kept up to date using pip. certifi.where() gives you the location to the certificate bundle.

如下所示:

import pycurl
import certifi
curl = pycurl.Curl()
curl.setopt(pycurl.CAINFO, certifi.where())
curl.setopt(pycurl.URL, 'https://www.mot.gov.cn/tongjishuju/shuiyun/index_1.html')
curl.perform()

全部评论: 0

    我有话说: