How to export a cookie in a file to use with python scrapy
Question: I want to login automatically to SO with my cookie using scrapy and python.
But i don't know

  1. How to export cookie to what format so that i can use it with scrapy
  2. There are many cookies listed in chrome for stackoverflow like this

Now which one to use for login `__qca_ _utma_ _utmb_ _utmc __utmz gauthedsgt
usrLocal storage`

3.What will be in that file and how to use that in Scrapy code


Answer: You should pass your cookie when you create first request to the server, as
said on [this page](http://doc.scrapy.org/en/latest/topics/request-
response.html):

    
    
    request_with_cookies = Request(url="http://www.example.com",
                               cookies={'currency': 'USD', 'country': 'UY'})
    

If you don't want which cookie is important for auth, use all of them or try
to use one of them. Also check that
[CookiesMiddleware](http://doc.scrapy.org/en/latest/topics/downloader-
middleware.html#cookies-mw) is enabled to get your cookies preserved in
further requests.

If you want to use cookies stored in a file I suggest you to write simple
parser of this file and convert file contents to python dict. As long as your
file is in simple plain text format, this will be easy.

