首页 > 解决方案 > 仅使用密码使用 Python 请求

问题描述

我正在尝试使用请求登录到一个只有密码字段而没有用户名的网站。每当我尝试使用简单的请求时:

response = requests.get(URL, auth = ('password'), verify=False)

我得到的只是要求输入密码的页面的 HTML 格式,如下所示:

'<html><head>\t<title>Relay Diagnostics Login page</title></head><body>\t<form action="/rd" method="POST">\t\tPlease, enter the password to access the Relay Diagnostics page:\t\t<br />\t\t<input type="password" placeholder="Password" name="password" />\t\t<br />\t\t<input type="submit" value="Login" />\t\t<input type="hidden" name="rnd" value="WtKEYTI64T3InibBmG+OKVM9dIo" />\t</form></body></html>'

反正有没有只用密码就可以通过身份验证?

谢谢

标签: python-requests

解决方案


很少有网站只有密码。尝试auth=('','password')auth=(None,'password')


推荐阅读