Bud P. Bruegger wrote:
> For testing, I would like to post to my Quixote app with a content type
> of plain/text. It seemed that neither urllib nor urllib2 does this.
> Any suggestions on how to wip up a quick test?
urllib2.Request can do it:
import urllib2
headers = {'Content-Type':'text/plain'}
request = urllib2.Request(url, post_data, headers)
response = urllib2.urlopen(request)
Because there's data, 'POST' is implied, but you have to set the
Content-Type explicitly, or it will assume the content is
application/x-www-form-urlencoded.
-- Graham