V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2018-02-17 18:31:53 +08:00 · 3106 次点击
    这是一个创建于 2231 天前的主题,其中的信息可能已经有所发展或是发生改变。
    Request 失败,程序跳转到 errback 的函数里之后还能重新跳回去继续执行程序吗?
    我因为 IP 代理用不了 Request 没成功,在 error 里删除该 IP 代理后怎么继续 Request 之前没成功的 url 呢? 就有点像汇编里的跳转。
    5 条回复    2018-02-19 20:05:07 +08:00
    nicevar
        2
    nicevar  
       2018-02-17 20:49:12 +08:00
    回调的 failure 里有 request 对象
    ChenJinluo
        3
    ChenJinluo  
    OP
       2018-02-18 17:21:26 +08:00
    @nicevar 有是有,可是这达不到我的目的-。-
    ws1689371
        4
    ws1689371  
       2018-02-18 19:54:10 +08:00
    改写下载器中间件不就行啦
    HarveyDent
        5
    HarveyDent  
       2018-02-19 20:05:07 +08:00
    你应该是想重试吧,你可以参考一下 RetryMiddleware。写了一个类继承 RetryMiddleware,process_exception 里边做的重试。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1221 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 18:06 · PVG 02:06 · LAX 11:06 · JFK 14:06
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.