[英]Log in to website behind CloudFlare using Python Requests
尝试将登录信息发布到网站,但似乎无法正常工作。
这是返回的错误:
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>cloudflare-nginx</center>
</body>
这是我尝试发布登录请求的表单:
<form name="loginform" id="loginform" method="post" action="login.php" onsubmit="return formVal();">
<table cellpadding="2" cellspacing="1" border="0" align="center">
<tr valign="top">
<td align="right">Username </td>
<td align="left"><input type="text" name="username" id="username" class="inputtext" autofocus="autofocus" /></td>
</tr>
<tr valign="top">
<td align="right">Password </td>
<td align="left"><input type="password" name="password" id="password" class="inputtext" /></td>
</tr>
<tr valign="top">
<td colspan="2" align="right"><input type="checkbox" name="keeplogged" value="1" />Keep me logged in</td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" name="login" value="Log In!" class="submit" /></td>
</tr>
</table>
<br /><br />
Lost your password? <a href="login.php?act=recover">Recover it here!</a>
请帮忙!
尝试先获取页面然后发布,就像这样 -
with cfscrape.create_scraper() as s:
p = s.get(login_url)
p = s.post(login_url, data=payload)
print p.content
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.