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)

  

posted @ 2019-10-14 14:21  圆柱模板  阅读(3479)  评论(0编辑  收藏  举报