前言
做接口自动化需要使用python发送请求,需要安装第三方模块requests实现发送get\post等请求
1.安装 requests
执行命令 pip install xx 是python的安装命令
2.发送get请求
默认返回的是状态码
如果需要查看内容 使用res.text属性
3.带有参数的get请求如何发送
带有参数的get请求需要传递params
发送 get带有参数的接口需要使用params传递参数,可以看下get请求源码,必填参数url,默认参数params可以为None,后面关键字参数我们可以填写cookie、header等关键字参数