Cookies in request object

Garth Grimm garth_grimm at hp.com
Wed Aug 15 14:04:13 EDT 2001


Thanks Joshua, doing

h.putheader('Cookie', 'chips=ahoy; vienna=finger')

worked just fine.  I guess I got so locked in to a thought process like
'make a Cookie object, attach it to the request object, etc., etc.'  that I
missed the relatively obvious thought process of 'send this string to the
server, send this other string to the server, etc., etc.,'

--
Garth


"Joshua Macy" <l0819m0v0smfm001 at sneakemail.com> wrote in message
news:3B79B05D.664515AA at sneakemail.com...
> 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