#上传json的post请求 r = requests.post(url,data=json,dumps(data))低版本
#r = requests.post(url,json=data)高版本
import requests
import json
url = "https://httpbin.org/post"
data = {"info":{"code":1,"sex":"男","id":1900,"name":"巧吧软件测试"},
"code":1,
"name":"巧吧软件测试","sex":"女",
"data":[{"code":1,"sex":"男","id":1900,"name":"巧吧软件测试"},{"code":1,"sex":"男","id":1900,"name":"巧吧软件测试"}],
"id":1900}
r = requests.post(url,json=data)
print(r.headers)
print(r.text)
转载于:https://www.cnblogs.com/smile2018tao/p/10171686.html