摘要:
基本认证是允许http用户代理(如:网页浏览器)在请求时,提供用户名和密码的一种方式。 自动化测试中,可以用auth参数传递认证信息 import requests from requests.auth import HTTPBasicAuth def test_auth(): r = reques 阅读全文
posted @ 2021-09-09 15:42
feifei_tian
阅读(99)
评论(0)
推荐(0)
摘要:
Cookie使用场景 在接口测试过程中, 很多情况下,需要发送的请求附带cookies,才能返回正常的结果。所以在使用python+requests进行接口自动化测试也是同理, 需要在构造接口测试用例时加入cookie。 传递Cookie的两种方式: 1. 请求头headers信息传递 import 阅读全文
posted @ 2021-09-09 14:34
feifei_tian
阅读(58)
评论(0)
推荐(0)
摘要:
http://hamcrest.org/ import requests from hamcrest import * def test_post_json(self): payload = { "level": 1, "name": "xuefeifei" } r = requests.post( 阅读全文
posted @ 2021-09-09 10:21
feifei_tian
阅读(52)
评论(0)
推荐(0)
摘要:
import requests from jsonpath import jsonpath def test_post_json(self): payload = { "level": 1, "name": "xuefeifei" } r = requests.post("https://httpb 阅读全文
posted @ 2021-09-09 10:03
feifei_tian
阅读(168)
评论(0)
推荐(0)

浙公网安备 33010602011771号