Python post json

def post_json():
    url = 'http://x.x.x.x/api/v1/builds/report/'
    data = make_json()
    headers = {"Content-Type": "application/json; charset=UTF-8", }
    conn = httplib.HTTPConnection("x.x.x.x", 80)
    conn.request('POST', url, json.dumps(data), headers)
    response = conn.getresponse()
    res = response.read()
    print res

你可能感兴趣的:(python)