python抓取网站提示错误ssl.SSLCertVerificationError处理

问题描述

python在抓取制定网站的错误提示:
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1056)

解决方式

在使用请求方法时添加一个参数verify = false就行了,如下:

response = self.lagou_session.get(url=url,headers=self.header,verify=False)

res = requests.post(url, data = textmod,  headers = header_dict, verify=False)
厂家CPU内存硬盘流量价格购买链接
RamNode11GB25GB-SSD500GB/mUSD $5购买
Linode11GB25GB-SSD1000GB/mUSD $5购买
DigitalOcean11GB25GB-SSD1000GB/mUSD $5/m购买
Vultr11GB25GB-SSD1000GB/mUSD $5/m购买
腾讯云Qcloud22GB50GB-SSD购买

Posted

in

by

Comments

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注