scrapy设置和查看Cookie

设置Cookie

settings文件中给Cookies_enabled=False解注释
settings的headers配置的cookie就可以用了

def start_requests(self):
    yield scrapy.Request(url,dont_filter=True,cookies={your cookie})

获取Cookie

#请求Cookie
Cookie = response.request.headers.getlist('Cookie')

#响应Cookie
Cookie = response.headers.getlist('Set-Cookie')