Access session cookie in scrapy spiders

前端 未结 3 887
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-28 17:07

I am trying to access the session cookie within a spider. I first login to a social network using in a spider:

    def parse(self, response):

        retur         


        
3条回答
  •  半阙折子戏
    2020-12-28 17:49

    This works for me

    response.request.headers.get('Cookie')
    

    It seems to return all the cookies that where introduced by the middleware in the request, session's or otherwise.

提交回复
热议问题