V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
wersonliu9527
V2EX  ›  Python

请教 scrapy 爬虫的一个问题,中间件问题

  •  
  •   wersonliu9527 · Jun 20, 2019 · 2709 views
    This topic created in 2517 days ago, the information mentioned may be changed or developed.

    一个工程下有很多 spider 类(图一),每个类有独立的 custom_settings (图 2 ),我自定义的重试中间件没有生效(图 3 ),其他的公共的随机头,单独的 item 管道生效了。请问自定义重试中间件如何配置呢. scrapy.downloadermiddlewares.retry.RetryMiddleware 写成这样似乎也没开启

    1.png 2.png 3.png

    4 replies    2019-06-20 18:44:15 +08:00
    daiqiangbudainiu
        1
    daiqiangbudainiu  
       Jun 20, 2019
    550 好像大于框架自带的 retry middleware,你可以手动关闭框架自带的 retry middleware 试试
    tikazyq
        2
    tikazyq  
       Jun 20, 2019   ❤️ 1
    这么多爬虫,不如试一下 crawlab 的可配置爬虫

    https: / /github.com /tikazyq/crawlab
    limuyan44
        3
    limuyan44  
       Jun 20, 2019 via Android
    记得有些是需要关闭自带的不知道你这个有没有
    wersonliu9527
        4
    wersonliu9527  
    OP
       Jun 20, 2019
    @warcraft1236

    @limuyan44
    感谢各位的回复,在 custom_settings 中配置自定义重试总是不生效,最后在 setting 文件中生效了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4913 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 09:53 · PVG 17:53 · LAX 02:53 · JFK 05:53
    ♥ Do have faith in what you're doing.