Python urllib post with different content type than urlencoded
Not with urllib, as you'd need to set the Content-type
header, and urllib does not provide a way to do so. You can do it however with urllib2 (but also not with urlopen()
wich is more meant to "open files with a url" rather than submitting data):
import urllib2req = urllib2.Request('http://www.example.com/', data="abc", headers={'Content-type': 'text/plain'})r = urllib2.urlopen(req)
Personally, I prefer httplib2 (3d party) as a http client library.