编程语言
首页 > 编程语言> > python+requests auth认证

python+requests auth认证

作者:互联网

代码:

import requests


from requests.auth import HTTPBasicAuth


def test_auth():
    res=requests.get(url="https://httpbin.testing-studio.com/basic-auth/banana/123",
                 auth=HTTPBasicAuth("banana","123"))
    print(res.json())

  执行结果:

 

 

  

 

标签:python,res,auth,123,import,requests,banana
来源: https://www.cnblogs.com/crystal1126/p/15147521.html