http basic 基本认证
基本认证是允许http用户代理(如:网页浏览器)在请求时,提供用户名和密码的一种方式。
自动化测试中,可以用auth参数传递认证信息
import requests from requests.auth import HTTPBasicAuth def test_auth(): r = requests.get(url = "https://httpbin.testing-studio.com/basic-auth/xuefeifei/123", auth = HTTPBasicAuth("xuefeifei","123")) print(r.text)