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\')) 相关文章: 2021-10-04 2021-07-30 2021-05-25 2021-09-05 2021-05-31 2022-12-23 2022-12-23