httplib and cookies

Moshe Zadka moshez at zadka.site.co.il
Tue Jan 16 22:33:48 EST 2001


On 16 Jan 2001 09:47:32 -0800, Johann Hibschman <johann at physics.berkeley.edu> wrote:
> Hi folks, webby question here.
> 
> Is there a way I can get httplib to handle cookie setting and requests
> from the server?

Cookies are sent with a "Set-Cookie" header. You'll have to parse this
(yourself: if the cookie is simple, you can use crude tricks), and then
send this back in a "Cookie" header. You can even do it with 
urllib.FancyURLopener, just use the .addheader() method (but be aware that if 
there are redirects involved, you're probably better off using URLopener
and handling the redirects yourself)
-- 
Moshe Zadka <sig at zadka.site.co.il>
This is a signature anti-virus. 
Please stop the spread of signature viruses!




More information about the Python-list mailing list