#r = requests.post(url,json=data)

#上传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)
posted @ 2018-12-24 23:35  测试小白学习之路  阅读(2534)  评论(0编辑  收藏  举报