Python:使用python在网站上提交表单

时间:2015-12-20 13:42:57

标签: python web-scraping urllib2 mechanize

以下是我要登录的页面的html

<FORM NAME="form" METHOD="POST" ACTION="./memberlogin" onsubmit="this.onsubmit= function(){return false;}">


<table class='loginTbl' border='1' align="center" cellspacing='3' cellpadding='3' width='60%'>
   <input type="hidden" name="hdnrequesttype" value="1" />
   <thead>
   <tr>
    <td colspan='3' align="middle" class='loginHead'>Login</td>
   </tr>
   </thead>

   <tbody class='loginBody'>

   <tr>
    <td class='loginBodyTd1' nowrap="nowrap">Employee ID</td>
    <td class='loginBodyTd2'><input type='text' name='txtmemberid' id='txtmemberid' value='' class='loginTextBox' size='30' maxlength='8'/></td>
    <td class='loginBodyTd3' rowspan='2'><input type="submit" class="goclearbutton" value="  Go  "></td>
   </tr><input type='hidden' name='txtmemberpwd' id='txtmemberpwd' value='' />

   </tbody>

   <tfoot>
    <tr>
        <td colspan='3' class='loginFoot'>
            <font class='loginRed'>New Visitor?</font>

            <a href="mailto:admin@libsys.co.in?subject=New Registration&body=New Registartion Request">Send</a> your registration request to library !

           </td>
       </tr>
   </tfoot>

   </table>
   </form>

我对谷歌进行了一些研究,发现我要使用请求对象或urllib或机械化。所有这些都令人困惑,请告诉我最简单的方法。

0 个答案:

没有答案