title: Storing cookielib cookies in a database
body: <p>I'm using the <code>cookielib</code> module to handle HTTP cookies when using the <code>urllib2</code> module in Python 2.6 in a way similar to this snippet:</p>
  
  <pre><code>import cookielib, urllib2
  cj = cookielib.CookieJar()
  opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
  r = opener.open("http://example.com/")
  </code></pre>
  
  <p>I'd like to store the cookies in a database. I don't know whats better - serialize the <code>CookieJar</code> object and store it or extract the cookies from the <code>CookieJar</code> 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 <code>CookieJar</code> object.</p>
  
  <p>Could someone help me out with the above?</p>
  
  <p>Thanks in advance.</p>