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

php - Creating canonical URLs with custom route-classes -

Mysql Local server hardware -

mysql - Formatting problem with PHP DateTime Difference when used as part of an equation -