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

scrapy 怎么用一个 session 来访问几个 url?

  •  
  •   fusae · Jun 11, 2016 · 3702 views
    This topic created in 3639 days ago, the information mentioned may be changed or developed.

    需要提交的表单里面有个验证码,我需要先把验证码下下来再转换成文本放上去,然后 post 到一个 URL 里。这里面应该要用同一个 session 才可以完成。 requests 里面用 session 就很方便,想请问下在 scrapy 里怎么使用同一个 session?

    4 replies    2016-06-12 18:15:27 +08:00
    windfarer
        1
    windfarer  
       Jun 11, 2016 via Android
    cookiejar
    fusae
        2
    fusae  
    OP
       Jun 11, 2016
    @windfarer 我在每个 request 都加了相同的 meta ,可都不行。
    jedihy
        3
    jedihy  
       Jun 12, 2016 via iPhone
    本身就会是一个 session ,如果域名相同的话
    fusae
        4
    fusae  
    OP
       Jun 12, 2016
    我把 headers 里所有东西都加进去,就可以了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3036 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 03:06 · PVG 11:06 · LAX 20:06 · JFK 23:06
    ♥ Do have faith in what you're doing.