Suggestion: "Completing" HTTP support in Python.

Karl G. Ulbrich karl_python at sub.ulbrich.org
Thu Jun 15 21:36:22 EDT 2000


Quoting Oleg Broytmann (phd at phd.russ.ru):
> > How do you add HTTP parameters?
> > How do you specify that the connection should be POST or GET?
> 
> GET:  filename, headers = urllib.urlretrieve("http://my.host.name:8080/loginscript?%s" % urllib.urlencode({"param": value}))
> POST: filename, headers = urllib.urlretrieve("http://my.host.name:8080/loginscript", urllib.urlencode({"param": value}))

Note that POST support in urllib lacks support for posting form contents
that include files to be uploaded.  That means you're back to down and 
dirty with the HTTPlib and some ugly http and mime boundary syntax.

What I need (and am writing as a 1st Python project) is something that'll
let me post an arbitrary mix of normal fields and file-upload-fields+files
to a URL.  (usage: POST a file, title, and description field).  

I'd love to see this support (and some of the other stuff in this thread)
make it into urllib as easy-to-use methods.

Karl Ulbrich







More information about the Python-list mailing list