有时爬虫会报如下超时错误:
Traceback (most recent call last):
File "/opt/pyspider/pyspider/run.py", line 351, in <lambda>
app.config['fetch'] = lambda x: umsgpack.unpackb(fetcher_rpc.fetch(x).data)
File "/usr/lib/python2.7/xmlrpclib.py", line 1233, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1587, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/xmlrpclib.py", line 1273, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib/python2.7/xmlrpclib.py", line 1321, in single_request
response.msg,
ProtocolError: <ProtocolError for fetcher/: 504 Gateway Time-out>
请问有什么好的方法避免?
ringa_lee2017-04-18 09:47:14
@zuzhaochong
This is indeed a front-end misalignment during debugging, and the fetcher in the background will report such an error:
[E 161014 23:45:09 tornado_fetcher:202] [599] douban:f25b579c7b441d19bc800412cccb145b https://movie .douban.com/revi... ValueError('No JSON object could be decoded',) 50.00s
After I finished debugging, when I actually started crawling, there would be a lot of this error after a while, and on the page The crawler status is displayed as "PAUSED". What's the problem? How to solve it?