作者:jtzhn_146_607 | 来源:互联网 | 2023-09-03 11:35
Requests库有一个auth模块专门用来处理HTTP认证:importrequestsfromrequests.authimportAuthBasefromrequests.a
Requests 库有一个auth 模块专门用来处理HTTP 认证:
import requests
from requests.auth import AuthBase
from requests.auth import HTTPBasicAuth
auth = HTTPBasicAuth(‘ryan‘, ‘password‘)
r = requests.post(url="http://pythonscraping.com/pages/auth/login.php", auth=auth)
print(r.text)