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

Kevin Carlson khcarlso at bellsouth.net
Thu Jun 5 10:21:02 EDT 2003


Ng Pheng Siong wrote:

>According to Kevin Carlson  <khcarlso at bellsouth.net>:
>
>>I actually only need to send a couple of text inputs to the form, but no 
>>matter what, the host system acts like I input nothing into the form.  I 
>>have tried this:
>>
>
>Maybe the form has some Javascript that validates the data and invokes a
>secret handshake, like sending extra hidden fields or returning a cookie?
>

Thanks for help on this one -- I got the first POST working.  It was a 
problem with formatting the multipart/form-data.  Once I got the proper 
format it worked fine.  Interesting you should bring up cookies, though...

The response from the POST returns a cookie that I need to pass along to 
the host on the subsequent request.  I don't see and methods in httplib 
to deal with cookies directly, nor can I find any in the HTTPResponse.py 
source that allow me to extract the cookie from the response.  I'm sure 
I'm missing something.  Any additional pointers?

Kevin






More information about the Python-list mailing list