首页 > 代码库 > requests-认证设置

requests-认证设置

1 #如果需要用户名和密码才能登陆网站,则需要认证设置auth=()
2 import requests
3 response = requests.get(url,auth=(user,password))
4 
5 #或者
6 from requests.auth import HTTPBasicAuth
7 response = requests.get(url,auth=HTTPBasicAuth(user,password))

 

requests-认证设置