using urllib or httplib to post with ENCTYPE=mulitpart/form-data

Kevin Carlson nskhcarlso at bellsouth.net
Mon Jun 9 17:17:03 EDT 2003


Never mind.  I don't think the ClientCookie is going to help me here. 
As someone had eluded earlier in this thread, the cookie is not coming 
back as a header.  I was looking through the headers and couldn't see a 
Set-Cookie header -- thought I was going crazy.

As it turns out, one of the pages in the frameset contains Javascript 
that creates the cookie. I can parse that for the Cookie and send it 
back in subsequent requests.

Thanks for everyone's help!



John J. Lee wrote:
> Kevin Carlson <nskhcarlso at bellsouth.net> writes:
> [...]
> 
>>Is there any way to use ClientCookie with httplib rather that urllib
>>or urllib2?
> 
> 
> No reason why not, but IMHO perverse.  :-)
> 
> You just have to call extract_cookies and add_cookie_header manually,
> which means you need to make a couple of objects that satisfy the
> request and response interfaces specified in the docstrings for those
> methods (easy enough I guess, though I haven't done it myself):
> 
> from ClientCookie import Cookies
> print Cookies.extract_cookies.__doc__
> print Cookies.add_cookie_header.__doc__
> 
> I just released a 0.4.1a version.  Despite the alpha status, I
> recommend using that if you're writing new code (or even if you're
> not, probably).
> 
> 
> John






More information about the Python-list mailing list