Cookies in request object

Joshua Macy l0819m0v0smfm001 at sneakemail.com
Tue Aug 14 23:09:55 EDT 2001


Garth Grimm wrote:
> 
> I feel that I should have been able to figure this out on my own, or by
> using the python docs, but I haven't been able to.
> 
> How do I attach a Cookie object to an HTTP request object?

  I think what you're looking for is:

  httplib.setheader("Cookie:", "name=value; path; domain")

  
  It's documented in the HTTP object docs, although the doc on setheader
doesn't specifically mention cookies (but RFC2109 lays out cookie
headers in all their gory detail, e.g. at
http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc2109.html ).  Actually,
looking at the docs I can't tell whether you need the colon after Cookie
or if setheader will put it in itself; you'll have to experiment a bit
with it.  And of course name, value, and the optional path and domain
should have your values...

  Joshua



More information about the Python-list mailing list