Multi-Page login WITH Cookies (POST Data)

Dave Borne dborne at gmail.com
Fri May 18 10:09:55 EDT 2007


> After we are able to get a succussful login, i need a way that i can browse
> my site always including this cookie, like if i went to open up a page, it
> would use the cookie we got from logging in.

You need something like this:
import cookielib,urllib2
cookiejar = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar))

more info here: http://docs.python.org/lib/module-urllib2.html
and here: http://docs.python.org/lib/module-cookielib.html

-Dave



More information about the Python-list mailing list