http request with cookie sending

itay_k itayyy at gmail.com
Tue Apr 18 17:37:54 EDT 2006


Hi,

I want to send a cookie on some http request (with urllib2),
so I created a Cookie but I cant associate it with CookieJar object.

for example:

import Cookie
import cookielib, urllib2

C = Cookie.SimpleCookie()
C["a"] = "b"

cj = cookielib.CookieJar()
cj.set_cookie(C)

in the last line I got:
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Python24\lib\cookielib.py", line 1593, in set_cookie
    if cookie.domain not in c: c[cookie.domain] = {}
AttributeError: 'SimpleCookie' object has no attribute 'domain'

why?
maybe.. there is any code example for sending cookie with some http
request operation?

thanks alot,
Itay.




More information about the Python-list mailing list