Scripting HTTP POST - multipart/form-data

John J. Lee jjl at
Tue Jul 20 01:39:53 CEST 2004

Jeff Shannon <jeff at> writes:

> I'm looking to script a routine file-upload through an HTTP server
> (which I don't have access to).  I've got specs on the CGI app that
> receives this upload (i.e. field names and expected contents).

Forgot to add: if I had to do this and wanted to use ClientForm (which
I certainly would ;-), I'd just write a snippet of HTML:

formHtml = """\
<form action="">
  <input type="text" name="nrEmails" />

  <input type="checkbox" name="spamType" value="ludicrous" />
  <input type="checkbox" name="spamType" value="absurd" />

import StringIO
from ClientForm import ParseFile

forms = ParseFile(StringIO.StringIO(formHtml), "")

Which is surely a very readable way of writing down such a spec :-)

I should point this out in the docs...


More information about the Python-list mailing list