python - urllib2 and json -


Can anybody tell me the tutorial that tells me that using urllib2 with data in URLI2 How to make a POST request. Mesa's answer works only if the server is not bothered to see the content type header. If you want to actually work it, you will need to specify content-type header. Here's the answer to the modified Mesa to include header type:

  import Json import urllib2 data = json.dumps ([1, 2, 3]) req = urllib2.Request (url, data, {'content-type': 'application / jason'}) f = urib 2 Alappan (Reich) reserve = F.Drade () F.Claus ()  

Comments