title: python - add cookie to cookiejar
body: <p>How do I create a cookie and add it to a CookieJar instance in python? 
  I have all the info for the cookie (name, value, domain, path, etc) and I don't want to extract a new cookie with a http request. </p>
  
  <p>I tried this but it looks like SimpleCookie class is not compatible with CookieJar (is there another Cookie class?)</p>
  
  <pre><code>import Cookie
  c = Cookie.SimpleCookie()
  c["name"]="value"
  c['name']['expires'] = 0
  c['name']['path'] = "/"
  c['name']['domain'] = "mydomain.com"
  cj = cookielib.CookieJar()
  cj.set_cookie(cookie)
  
  Traceback (most recent call last):
      cj.set_cookie(cookie)
    File "/usr/lib/python2.6/cookielib.py", line 1627, in set_cookie
      if cookie.domain not in c: c[cookie.domain] = {}
  AttributeError: 'SimpleCookie' object has no attribute 'domain'
  </code></pre>