[英]scrapy - get cookies from response/request headers
I am trying to get the cookies from the request using this line of code but got []
empty result 我正在尝试使用此行代码从请求中获取Cookie,但结果为
[]
空
response.headers.getList('Set-Cookie')
and this 和这个
response.request.headers.get('Cookie')
when I open_in_browser
the response I inspect the Network tab and see the cookies exist (See image below) 当我
open_in_browser
响应时,我检查“网络”选项卡,并查看cookie是否存在(请参见下图)
Any Idea? 任何想法? Thank you
谢谢
response.headers.getlist("Set-Cookie")
works for me (Scrapy 1.4.0) response.headers.getlist("Set-Cookie")
对我有用(Scrapy 1.4.0)
But first, check in shell if you actually have received this cookie: 但首先,请检查外壳程序是否确实收到了此cookie:
scrapy shell
fetch('your_url')
response.headers.getlist("Set-Cookie")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.