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
zpwsmile
V2EX  ›  Python

请问如何在 scrapy 中使用非阻塞暂停

  •  
  •   zpwsmile · 2019-08-05 09:24:45 +08:00 · 1595 次点击
    这是一个创建于 1697 天前的主题,其中的信息可能已经有所发展或是发生改变。
    scrapy 中,如何使用非阻塞暂停?
    比如:
    有函数 parse(...)
    然后自己编写的 parse1(...)、parse2(...)。。。
    在 parse1(...) 的函数体中,想要有暂停操作,我用的 time.sleep 后发现整个程序全局都暂停了,
    请问如何在 scrapy 中使用非阻塞暂停
    AlloVince
        1
    AlloVince  
       2019-08-05 09:55:55 +08:00
    未验证,可以尝试 yield asyncio.sleep(5)
    zpwsmile
        2
    zpwsmile  
    OP
       2019-08-05 10:27:39 +08:00
    @AlloVince 好的,我验证下,谢谢~
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1046 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 19:16 · PVG 03:16 · LAX 12:16 · JFK 15:16
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.