curl - Python urllib post with different content type than urlencoded -


I understand that, to post with urlib, I need to use URL encoded content. Is it possible to use application / JSN content type when posting with?

not with urlib, like you do content-type headers, and urlib One does not provide a way to do this. You can do this but not with (but with urlopen () , instead of submitting this data, "Opening a file with a URL" means):

  urlib2 req = urllib2.Request ('http://www.example.com/', data = "ABC", header = {'content-type': 'text / plain'}) r = urllib2 .urlopen (req)   

Personally, I like (3D party) as a http client library.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -