前言

最近发现许多小伙伴在用 PySpider 爬取 https 开头的网站的时候遇到了 HTTP 599: SSL certificate problem: self signed certificate in certificate chain 的错误。

经过一番排查,解决方案总结如下

错误原因

这个错误会发生在请求 https 开头的网址,SSL 验证错误,证书有误。

报错如下

解决方案

最简单的解决方法是:

在 crawl 方法中加入忽略证书验证的参数,validate_cert=False,即

 
 
1
self.crawl(url,callback=method_name,validate_cert=False)

以上方法基本可以解决问题。

如果出现了

 
 
1
[E16032914:00:56base_handler:194]crawl()got unexpected keyword argument:['validate_cert']

的错误,即无法匹配到 validate_cert 参

数,那么则是 PySpider 本身的问题。

可以更新到最新版本,即更新到 master 分支。

因为包还没有发行,所以我们就手动来更新。

https://cuiqingcai.com/2703.html

转自静觅

前言

最近发现许多小伙伴在用 PySpider 爬取 https 开头的网站的时候遇到了 HTTP 599: SSL certificate problem: self signed certificate in certificate chain 的错误。

经过一番排查,解决方案总结如下

错误原因

这个错误会发生在请求 https 开头的网址,SSL 验证错误,证书有误。

报错如下

解决方案

最简单的解决方法是:

在 crawl 方法中加入忽略证书验证的参数,validate_cert=False,即

 
 
1
self.crawl(url,callback=method_name,validate_cert=False)

以上方法基本可以解决问题。

如果出现了

 
 
1
[E16032914:00:56base_handler:194]crawl()got unexpected keyword argument:['validate_cert']

的错误,即无法匹配到 validate_cert 参数,那么则是 PySpider 本身的问题。

目前的最新发行版是 0.3.6(2016/3/29),不过 GitHub 最新版本目前是 0.4.0

可以更新到最新版本,即更新到 master 分支。

因为包还没有发行,所以我们就手动来更新。

PySpider

可以点击右侧下载 zip 包。

Mac OS X

以 Mac OS X为例,找到 pyspider 库所在的路径。我的是在

 
 
1
/Library/Python/2.7/site-packages/pyspider

打开之后发现如下的结构。

把刚才的包下载下来之后,解压缩,打开文件夹,发现目录结构是这样的。

然后进入 pyspider 文件夹,观察一下,发现和我们之前安装的 pyspider 目录结构是一样的,没错,就是它了!

嗯,把所有的文件都更新到 site-packages/pyspider 目录中。

可以手动拖动替换,可以使用命令

 
 
1
2
cd pyspider
sudo python setup.py install

更新之后,然后重新启动 pyspider 。

 
 
1
pyspider all

再加入 validate_cert=False 参数,发现就不会出现刚才的问题了。

Linux

方法同上,pyspider 路径应该在

 
 
1
/usr/lib/python/site-packages/pyspider-0.3.6.egg/pyspider

替换一下下载下来的文件。

同样也可以使用命令

 
 
1
2
cd pyspider
sudo python setup.py install

Windows

方法同上,pyspider 路径应该在

 
 
1
python(python安装目录)/Lib/site-packages/pyspider

同样替换下载下来的文件即可。

命令同上

 
 
1
2
cd pyspider
sudo python setup.py install

结语

通过以上配置,我们解决了 PySpider 的 599 错误以及 validate_cert 参数不匹配的问题。

希望对大家有帮助!

转载请注明:静觅 » PySpider HTTP 599: SSL certificate problem错误的解决方法

PySpider HTTP 599: SSL certificate problem错误的解决方法(转)的更多相关文章

  1. PySpider HTTP 599: SSL certificate problem错误的解决方法

    在用 PySpider 爬取 https 开头的网站的时候遇到了 HTTP 599: SSL certificate problem: self signed certificate in certi ...

  2. PySpider 框架爬虫错误 HTTP 599: SSL certificate problem: unable to get local issuer certificate解决方案

    首先pyspider all启动pyspider的所有服务,然后访问http://localhost:5000创建一个爬虫任务:taobaomm,点开任务链接编辑http://localhost:50 ...

  3. HTTP 599: SSL certificate problem: unable to get local issuer certificate错误

    自己在用 PySpider 框架爬虫运行代码后时出现 HTTP 599: SSL certificate problem: unable to get local issuer certificate ...

  4. Git发生SSL certificate problem: certificate ha错误的解决方法

    这两天,不知道为什么,用Git提交代码到服务器时,总出现SSL certificate problem: unable to get local issuer certificate while ac ...

  5. Exception: HTTP 599: SSL certificate problem: unable to get local issuer certificate 解决办法

    使用Pyspider中报此错误. 错误原因: 这个错误会发生在请求 https 开头的网址,SSL 验证错误,证书有误. 解决方法: 使用self.crawl(url, callback=self.i ...

  6. Git发生SSL certificate problem: certificate ha错误

    这两天,不知道为什么,用Git提交代码到服务器时,总出现SSL certificate problem: unable to get local issuer certificate while ac ...

  7. curl: (60) SSL certificate problem: unable to get local issuer certificate 错误

    今天同事做微信管理的项目,请求接口返回如下错误SSL certificate problem: unable to get local issuer certificate. 此问题的出现是由于没有配 ...

  8. git中的SSL certificate problem: unable to get local issuer certificate错误的解决办法

    我们在使用git初始化一个项目时,尤其是通过git submodule update --init --remote初始化子模块时,可能会遇到下面这个错误: fatal: unable to acce ...

  9. Git错误:unable to access 'https://git.voicegu.com/qa/qa.git/': SSL certificate problem: unable to get local issuer certificate

    fatal: unable to access 'https://git.voicegu.com/qa/qa.git/': SSL certificate problem: unable to get ...

随机推荐

  1. Storm实战

    需求: spout输出一些手机品牌小写名称,第一个bolt将手机名称转成大写,第二个bolt在手机名称的后面再追加上时间. 项目目录: 导入相关的jar包. RandomWordSpout.java: ...

  2. 同学帮帮移动 H5 弹出层类组件:txbb-pop

    Txbb.Pop 同学帮帮弹出层类组件,简洁.无依赖,使用 CSS3 实现动画效果. 为什么要再造一遍轮子 弹出层是常见的业务场景,而且弹出层的业务场景很简单,没必要使用大而全的库,并且,我们经常会有 ...

  3. 在java中,List是个接口,那实现List接口的类有哪些,有什么区别?

    在java中,List是个接口,那实现List接口的类有哪些,有什么区别? 解答: ArrayList是使用数组方式存储数据,此数组元素数大于实际存储的数据以便增加和插入元素,它们都允许直接按序号索引 ...

  4. WinCC7.3 Win764位系统安装教程

    WinCC7.3 Win764位安装教程 (1)将ISO文件解压缩. (2)编辑Setup.ini文件 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/fo ...

  5. Anaconda2+Theano 安装过程中的所有的坑。。。

    写在前面的废话 上次搞theano安装还是一年多以前..anaconda才出到1.4,当时的AnacondaCE,直接安装完基本上theano啥的都一套成功.. 今天换了个电脑,重装anaconda, ...

  6. ubuntu14.04安装vmware workstation

    0) Do the basic system installation of Ubuntu 14.04 LTS (Server or Desktop) 1) wget the installer wg ...

  7. 【watcher】 #02 c# 中实现时间戳等,日期数字及大概率绝对随机数 实现

    在Wacher的项目中,用到了很多时间记录的地方,为了将来能够和在线数据打通,我们使用了时间戳来记录时间信息 由于c# 没有现成的方法,所以我们重新写了一个Helper类来帮助我们使用这些公共函数 同 ...

  8. java项目学习

    GitHub地址:https://github.com/zhanglei-workspace/shopping-management-system

  9. 自己根据java的LinkedList源码编写的一个简单的LinkedList实现

    自己实现了一个简单的LinkedList /** * Create by andy on 2018-07-03 11:44 * 根据 {@link java.util.LinkedList}源码 写了 ...

  10. angular_文本变化

    注意,在input中用ng-change的时候,一定要结合着ng-model用 开头,注意在这里添加了ng-app <!DOCTYPE html> <html lang=" ...