1
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.&nbsp;&copy;&nbsp;Mettle Networks</div>
</div>
</div>
</div>
</body>
</html>

通常使用的“编码和请求”方法(仍在学习)似乎在这里不起作用。如何提交数据和登录?顺便说一句,这个网页登录到我的 ISP 的“个人帐户”页面。

4

2 回答 2

1

您可能需要查看“帖子”而不是“获取”,查看requests包可能会有所帮助,这将相当容易地发布和获取

http://docs.python-requests.org/en/latest/

于 2013-06-14T19:07:09.863 回答
0

您应该下载请求包。

假设@TankorSmash找到了正确的 POST URL:

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会话对象应该已登录,您可以从那里继续前进。

于 2013-06-14T20:44:14.503 回答