python 发送HTTP请求 post json 格式

import json
test_data = {'pictureName':'1.jpg'}
 
requrl = "http://10.1.24.88:8090/api/load_pic"
headerdata = {"Content-type": "application/json"}
 
conn = httplib.HTTPConnection("10.1.24.88",8090)
 
conn.request('POST',requrl,json.dumps(test_data),headerdata) 
 
response = conn.getresponse()
 
res= response.read()
 
print res

猜你喜欢

转载自blog.csdn.net/mnasd/article/details/81567127