我运行了一个用tornado写的蜘蛛喜欢https://github.com/tornadoweb/tornado/blob/master/demos/webspider/webspider.py,of的课程,把httpclient.AsyncHTTPClient改成curl_httpclient.CurlAsyncHTTPClient by
httpclient.AsyncHTTPClient.configure('tornado.curl_httpclient.CurlAsyncHTTPClient')蜘蛛在windows 10.python3+,64上运行。
令人遗憾的是,错误出现了:
tornado.curl_httpclient.CurlError: HTTP 599: SSL certificate problem: unable to get local issuer certificate有人看到这个了吗?我在谷歌上搜索了一下,但是对于龙卷风中的蜘蛛来说demoe还不够多,我没有找到答案?
或者任何人都可以告诉我一些关于这个错误的事情?
发布于 2017-12-25 16:55:03
尝试在curl_httpclient.CurlAsyncHTTPClient中重写方法
curl_log = logging.getLogger('tornado.curl_httpclient')
class PersonAsyncHTTPClient(curl_httpclient.CurlAsyncHTTPClient):
def _curl_create(self):
curl = pycurl.Curl()
curl.setopt(pycurl.CAINFO, certifi.where()) # the soure had no this line.missing this line would come ssl error.
if curl_log.isEnabledFor(logging.DEBUG):
curl.setopt(pycurl.VERBOSE, 1)
curl.setopt(pycurl.DEBUGFUNCTION, self._curl_debug)
if hasattr(pycurl, 'PROTOCOLS'): # PROTOCOLS first appeared in pycurl 7.19.5 (2014-07-12)
curl.setopt(pycurl.PROTOCOLS, pycurl.PROTO_HTTP | pycurl.PROTO_HTTPS)
curl.setopt(pycurl.REDIR_PROTOCOLS, pycurl.PROTO_HTTP | pycurl.PROTO_HTTPS)
return curl当我们使用:
http_client = PersonAsyncHTTPClient()
req = httpclient.HTTPRequest(url='https://www.google.com.hk/', proxy_host='', proxy_port=1234)一切都会成功吗?
这就是全部~
https://stackoverflow.com/questions/47966926
复制相似问题