Hi,
I'm using the cookielib
module to handle HTTP cookies when using the urllib2
module in Python 2.6 in a way similar to this snippet:
import cookielib, urllib2
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
r = opener.open("http://example.com/")
I'd like to store the cookies in a database. I don't know whats better - serialize the CookieJar
object and store it or extract the cookies from the CookieJar
and store that. I don't know which one's better or how to implement either of them. I should be also be able to recreate the CookieJar
object.
Could someone help me out with the above?
Thanks in advance.