twisted.internet.错误。运行scrapy spid时出现连接错误

2024-05-19 00:23:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用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}

Tags: 用户debughttp代理错误connectionitemspider
1条回答
网友
1楼 · 发布于 2024-05-19 00:23:19

ITEM_PIPELINES设置不是list,而是dict

ITEM_PIPELINES = {
    'soufang.pipelines.MySQLStorePipeline': 100
}

除此之外,我不知道到底出了什么问题。我没看到你在设置中设置了USER_AGENT?另外,粘贴完整的日志。在

相关问题 更多 >

    热门问题