ClientCookie/urllib2 with persistent connections?

Chuck Bearden cbearden at hal-pc.org
Mon May 10 23:55:20 EDT 2004


On 2004-05-09, John J. Lee <jjl at pobox.com> wrote:
> Chuck Bearden <cbearden at hal-pc.org> writes:
>
>> My impression is that if I want to make several requests over a single,
>> persistent HTTP 1.1 connection, I must use httplib rather than urllib2
>> or ClientCookies.  Is that correct?
>
> Yes.
>
>
>> To put it another way, can I have cookie support over persistent
>> connections without having to code the cookie support myself?
>
> Yes.  You can use httplib direct, and use a couple of little functions
> to link it up to ClientCookie.  The request and response interfaces
> required are well-documented.  Here is a clumsy cobbled-together hack,
> for HTTP only, which may even work ;-)  No automatic redirection
> handling, proxy support, etc.  The cookies bit is simple (thanks to
> ClientCookie :-), it's the rest that's messy.

Many thanks for your response, and for the ClientCookies module!  I have
already put it to use through the urllib2 interface, and I will study
the examples in your posting as well.

Chuck



More information about the Python-list mailing list