pyspider框架爆599证书问题
2018-11-12 本文已影响0人
小憧憬
真的是一波未平一波又起,降低自己的python版本后,进入pyspider框架之后,输入网址就立马报错。也只能立即找寻谷歌了
报599错:
HTTP 599: SSL certificate problem: unable to get local issuer certificate
[E 161018 21:56:36 base_handler:195] HTTP 599: SSL certificate problem: unable to get local issuer certificate
Traceback (most recent call last):
File “C:\Python27\lib\site-packages\pyspider\libs\base_handler.py”, line 188, in run_task
result = self._run_task(task, response)
File “C:\Python27\lib\site-packages\pyspider\libs\base_handler.py”, line 167, in _run_task
response.raise_for_status()
File “C:\Python27\lib\site-packages\pyspider\libs\response.py”, line 190, in raise_for_status
raise http_error
HTTPError: HTTP 599: SSL certificate problem: unable to get local issuer certificate
原因分析:
因为https协议需要对证书进行验证导致,对访问https网络需要证书
解决方法:
在两个抓取函数中加入不要检验证书:validate_cert=False
self.crawl('https://www.tripadvisor.cn/Attractions-g255060-Activities-c47-Sydney_New_South_Wales.html',validate_cert=False, callback=self.index_page)
self.crawl(each.attr.href,validate_cert=False, callback=self.detail_page)
问题解决!!!