ajax post python,jquery - convert an ajax http post to python - Stack Overflow

I want to send some data to a server using Python.

I have a working piece of code from jQuery which does what I want:

$.ajax({

type: "POST",

contentType: "text/plain",

url: "http://192.168.50.88/emoncms/nodes/1/tx/values",

data: "17,58,5,1569,0,3000,236"

});

I need to do the same thing in Python but I can't see how to do it. Here's what I've got at the moment:

import httplib, urllib

newdata = "17,58, 5,1569, 0, 3000, 236"

headers = {"Content-type": "text/plain"}

conn = httplib.HTTPConnection("192.168.50.88")

conn.request("POST", "/emoncms/nodes/1/tx/values", newdata)

response = conn.getresponse()

print response.status, response.reason

conn.close()

This prints: "200 OK" so the basic post is working but my data doesn't reach the server.

Can anyone point me in the right direction?