接口自动化测试--requests模块

接口自动化测试--requests模块

安装

命令⾏通过pip⼯具进⾏安装,命令:

python 复制代码
pip install requests==2.31.0

介绍

requests 库是⼀个⾮常流⾏的HTTP客⼾端库,⽤于发送HTTP请求。 requests.get ⽅法⽤于发送⼀个HTTP get 请求到指定的URL

requests.get ⽅法返回⼀个 Response 对象,这个对象包含了服务器返回的所有信息。

Response 对象提供的属性/⽅法介绍:

params ⽤于在URL中传递查询参数(Query Parameters),通常⽤于 GET 请求,但也可以⽤于其他类型的请求。

• json ⽤于在请求体(Body)中传递 JSON 格式的数据,通常⽤于 POST 或 PUT 请求。

据,通常⽤于 POST 或 PUT 请求。

• data ⽤于在请求体(Body)中传递表单数据,通常⽤于 POST 或 PUT 请求。

相关推荐
在世修行4 天前
干货:pytest
pytest·fixture·pytest assert
小小龙学IT5 天前
Python pytest 测试框架深度解析:从断言重写到插件生态的工程化测试体系
网络·python·pytest
落魄大学生之流水线上谋生计7 天前
pytest 入门与实践:从第一个测试到可维护的测试体系
pytest
念越9 天前
Allure 测试报告保姆级教程:从安装到 pytest 集成与报告生成
pytest·allure
念越9 天前
接口自动化测试从入门到实战:接口用例设计、Requests、Pytest、YAML、JSON Schema 与 Allure 报告
python·测试工具·自动化·json·pytest
霍格沃兹测试学院-小舟畅学13 天前
AI+Swagger:一键生成500条pytest接口用例
人工智能·pytest
把头塞进显示器22 天前
电商平台-测试报告
python·selenium·pytest
昔我往昔1 个月前
pytest日志问题排查记录
python·pytest
黄昏恋慕黎明1 个月前
博客论坛技术迭代
python·pytest
2601_962078231 个月前
Python接口自动化流程(pytest)
python·pytest·接口自动化·测试框架·断言