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())

  执行结果:

 

 

  

 

posted on 2021-08-16 13:59  crystal1126  阅读(684)  评论(0编辑  收藏  举报

导航