2019-07-16 Python接口测试实现获取登陆后的cookie访问下个接口

coding:utf-8

import requests
url="你的登陆接口"
par={"mobile":"13225811329","passwd":"ws123456","from":"ios"}
r=requests.post(url,data=par)
s=requests.session()
print(r.cookies)

获取登录后的cookie

cookies=r.cookies
url1="你要测的登陆接口"
par1={"type":"1","limit":"0.5"}
r1=s.post(url1,data=par1,cookies=cookies)
print(r1.text)

你可能感兴趣的:(2019-07-16 Python接口测试实现获取登陆后的cookie访问下个接口)