python接口测试中发送请求中的一些参数

s=requests.session

#设置一个参数禁止重定向:allow_redirects=False(allow_redirects=True 是启动重定向)

#关闭ssl认证:verify=False

#设置请求超时:timeout=20

r= s.request('methon',base_url, headers=header, data=data, allow_redirects=False,verify=False,timeout=20)

#获取重定向后的地址

print (r.status_code)

new_url = r.headers["Location"]

本博客纯粹是学习过程中的笔记,部分来自转载或摘抄,如有侵权,请联系删除 email:18017870857@163.com
原文地址:https://www.cnblogs.com/yanzhuping/p/14107692.html