推荐学习书目
› 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
ChenJinluo
V2EX  ›  Python

大家新年好~菜鸟想问下 Scrapy 中 Request 出错跳到 errback 的函数里之后又怎么跳回去呢?

  •  
  •   ChenJinluo · Feb 17, 2018 · 4421 views
    This topic created in 3185 days ago, the information mentioned may be changed or developed.
    Request 失败,程序跳转到 errback 的函数里之后还能重新跳回去继续执行程序吗?
    我因为 IP 代理用不了 Request 没成功,在 error 里删除该 IP 代理后怎么继续 Request 之前没成功的 url 呢? 就有点像汇编里的跳转。
    5 replies  •  2018-02-19 20:05:07 +08:00
    nicevar
    nicevar
    Feb 17, 2018
    2
    回调的 failure 里有 request 对象
    ChenJinluo
    ChenJinluo
    OP
    Feb 18, 2018
    3
    @nicevar 有是有,可是这达不到我的目的-。-
    ws1689371
    ws1689371
    Feb 18, 2018
    4
    改写下载器中间件不就行啦
    HarveyDent
    HarveyDent
    Feb 19, 2018
    5
    你应该是想重试吧,你可以参考一下 RetryMiddleware。写了一个类继承 RetryMiddleware,process_exception 里边做的重试。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1234 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 00:50 · PVG 08:50 · LAX 16:50 · JFK 19:50
    ♥ Do have faith in what you're doing.