我使用scrapy运行一个spider,得到以下错误:
DEBUG: Retrying http://xixichengyuanlc.fang.com/esf/> (failed 2 times): An error occurred while connecting: [Failure instance: Traceback (failure with no frames): : Connection to the other side was lost in a non-clean fashion: Connection lost.
我曾经成功地运行过这个spider好几次,但是我想使用一些用户代理来更快地运行并获得上面的错误。一开始我认为我的用户代理可能有问题,所以我检查了一下,但还是无法确定出去。还有然后我想再次尝试以前的蜘蛛,但仍然得到同样的错误。在
以下是我的设置.py
# Scrapy settings for soufang project
SPIDER_MODULES = ['soufang.spiders']
NEWSPIDER_MODULE = 'soufang.spiders'
DEFAULT_ITEM_CLASS = 'soufang.items.Community_info'
ITEM_PIPELINES = ['soufang.pipelines.MySQLStorePipeline']
#DOWNLOADER_MIDDLEWARES={
#'scrapy.contrib.downloadermiddleware.useragent.UserAgentMiddleware': None,
#'soufang.misc.middlewares.CustomUserAgentMiddleware':400}
ITEM_PIPELINES
设置不是list
,而是dict
:除此之外,我不知道到底出了什么问题。我没看到你在设置中设置了
USER_AGENT
?另外,粘贴完整的日志。在相关问题 更多 >
编程相关推荐