download pages using a cookies.txt file

Jabba Laci jabba.laci at
Sat Sep 10 23:20:26 EDT 2011


Thanks, I could put together the pieces and here is my solution:

(1) get_cookies_in_cookiejar function to extract cookies and put them
in a cookiejar:

(2) download page using urllib2 and passing the cookiejar:
See the bottom with get_page_with_cookies_using_cookiejar(url).


On Mon, Sep 5, 2011 at 22:19, Chris Rebert <clp2 at> wrote:
> On Mon, Sep 5, 2011 at 6:36 PM, Jabba Laci <jabba.laci at> wrote:
>> Hi,
>> I would like to download a page that requires authentication with
>> cookies. I've already figured out how to do it with wget (blog post
>> here: In short:
>> (1) extract cookies from Firefox's cookies.sqlite and store them in a text file
>> (2) wget --cookies=on --load-cookies=cookies.txt
>> --keep-session-cookies "http://..."
>> My question is: how to do it from Python?
> Cheers,
> Chris

More information about the Python-list mailing list