【发布时间】:2019-05-10 20:16:17
【问题描述】:
我正在运行以下脚本来登录我大学的强制门户:
import requests
values = {'username':'cisco','password':'cisco'}
r = requests.post('http://10.163.0.1/login',data=values)
print(r.text)
我得到以下输出:
<html>
<body>
<center>
If you are not redirected in a few seconds, click 'continue' below<br>
<form name="redirect" action="https://muj.i-on.in/" method="post">
<input type="hidden" name="mac" value="7C:76:35:F4:73:56">
<input type="hidden" name="ip" value="10.163.5.38">
<input type="hidden" name="username" value="cisco">
<input type="hidden" name="link-login" value="http://10.163.0.1/login">
<input type="hidden" name="link-orig" value="">
<input type="hidden" name="error" value="Could not locate user
profile from context for authorization: c">
<input type="hidden" name="chap-id" value="">
<input type="hidden" name="chap-challenge" value="">
<input type="hidden" name="link-login-only" value="http://10.163.0.1/login">
<input type="hidden" name="link-orig-esc" value="">
<input type="hidden" name="mac-esc" value="7C%3A76%3A35%3AF4%3A73%3A56">
<input type="hidden" name="interface-name" value="B2_Hostel-163">
<input type="submit" value="continue">
</form>
<script language="JavaScript">
<!--
document.redirect.submit();
//-->
</script>
</center>
</body>
</html>
由于以下错误,我无法登录:
<html>
<input type="hidden" name="error" value="Could not locate user
profile from context for authorization: c">
</html>
我可以做些什么来解决这个问题?
【问题讨论】:
-
网站使用什么样的身份验证? HTTP 基本身份验证,还是其他?
标签: python python-3.x http python-requests