Ewig
V2EX  ›  问与答

在请求爬虫的时候 cookie 传入的方式不同 返回的数据不一样

  •  
  •   Ewig · Dec 7, 2018 · 1660 views
    This topic created in 2891 days ago, the information mentioned may be changed or developed.

    我在请求一些网站的时候 ,cookie 以 str 方式 放入 cookie 里面 还有一种是 header 和 cookie 分开参数传递的 比如这种 headers=headers,cookie=cookie

    还有一种是就是把 cookie 直接写到 header 里面

    4 replies  •  2018-12-08 11:01:01 +08:00
    luosuosile
    luosuosile
    Dec 7, 2018
    1
    因为有时候 cookie 会关闭吧
    luoleng
    luoleng
    Dec 7, 2018
    2
    scrapy 的 setting 里面有个 COOKIES_ENABLED 的参数
    Ewig
    Ewig
    OP
    Dec 8, 2018
    3
    @luoleng 我设置为 true 了没用的
    Ewig
    Ewig
    OP
    Dec 8, 2018
    4
    @luosuosile 我设置 COOKIES_ENABLED=true
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2198 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 11:27 · PVG 19:27 · LAX 03:27 · JFK 06:27
    ♥ Do have faith in what you're doing.