download pages using a cookies.txt file

Sahil Tandon sahil at FreeBSD.org
Tue Sep 6 03:45:02 CEST 2011


On Mon, 2011-09-05 at 21:36:46 -0400, Jabba Laci wrote:

> 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? If possible, I want to avoid
> making external calls to wget.

Have you already explored the cookielib (known as http.cookiejar in
Python 3.0) module?

-- 
Sahil Tandon <sahil at FreeBSD.org>



More information about the Python-list mailing list