What "Content-type" shall I use?

A printers at sendme.cz
Sat May 3 05:52:09 EDT 2003


Hi,
I use httplib to automatically filled in some fields in web page forms.
I use a similar program like the example in Python DOC that is
 import httplib, urllib
 params = "spam=1&eggs=2&bacon=0" 
 h = httplib.HTTP("www.musi-cal.com:80")
 h.putrequest("POST", "/cgi-bin/query")
 h.putheader("Content-type", "application/x-www-form-urlencoded")
 h.putheader("Content-length", "%d" % len(params))
 h.putheader('Accept', 'text/plain')
 h.putheader('Host', 'www.musi-cal.com')
 h.endheaders()
 h.send(params)

So, as you can see params are
name1=Value1&name2=Value2&....nameN=ValueN
My question is:
If a form uses
 "multipart/form-data" instead of 
"application/x-www-form-urlencoded"
in which form params (data) must be?
Thanks for help
Ladislav






More information about the Python-list mailing list