download pages using a cookies.txt file

Chris Rebert clp2 at rebertia.com
Tue Sep 6 04:19:17 CEST 2011


On Mon, Sep 5, 2011 at 6:36 PM, Jabba Laci <jabba.laci at gmail.com> 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: http://bit.ly/pp25LP). 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?

http://docs.python.org/library/cookielib.html#cookielib.MozillaCookieJar

Cheers,
Chris



More information about the Python-list mailing list