Python教程

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+requests auth认证的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!