url : https://myaccount.adlkerala.com/login.php
页面来源:
<html>
<head>
<title>Mettle-Wire Login</title>
<style type="text/css">
@import "/mettle.css";
</style>
</head>
<body style="background-color: #fff;">
<div align="center">
<form method="post">
<table cellpadding="2" cellspacing="3">
<tr>
<td colspan="2" style="text-align:center;">
<br>
<div id="clientlogo-center"></div>
<br>
</td>
</tr>
<tr>
<td colspan="2" align="center"><b>Login</b></td>
</tr>
<tr>
<td>Username</td>
<td><input type="text" name="username" value=""></td>
<tr>
<tr>
<td>Password</td>
<td><input type="password" name="pass"></td>
<tr>
<td align="center" colspan="2"><input type="submit" value="Login"></td>
</tr>
</table>
</form>
</div> <!--container-->
<div id="logofooter"><a href="http://www.mettlenetworks.com/products/mettlewire.html?mwa"><span id="logo"><img src="images/g64m.png" alt="METTLE Wire" style="border:none;"></span></a> ver. 1.9. © Mettle Networks</div>
</div>
</div>
</div>
</body>
</html>
通常使用的'编码和请求'方法(仍在学习)似乎不在这里工作。如何提交数据和登录? 顺便说一下,这个网页登录我的ISP的“个人账户”页面。
答案 0 :(得分:1)
您可能需要查看“帖子”而不是“获取”,查看requests
包可能会有所帮助,这会很容易地发帖并获取
答案 1 :(得分:0)
您应该下载requests包。
假设 @TankorSmash 找到了正确的POST网址:
import requests
# set username and password here
username = <username>
password = <password>
s = requests.session()
r = s.post('https://myaccount.adlkerala.com/login.php', data={'username': username, 'pass': password})
现在,应该登录s
会话对象,然后您可以从那里继续前进。