我搜索这种情况的解决方案:
我使用mechanicalsoup 进入网络:
import mechanicalsoup
from bs4 import BeautifulSoup as bs4
browser = mechanicalsoup.StatefulBrowser()
browser.open("http://webinto.com/into/")
browser.select_form('form[action=""]')
browser["user"] ="user1"
browser["password"] ="password1"
browser.submit_selected()
print(browser.get_current_page())
我看到了一个应用程序列表:
<td width="394px">
<img alt="" height="16" src="authorizator/vineta.item.gif" title="" width="16"/>
<form action="" enctype="application/x-www-form-urlencoded" method="post" name="f0">
<input name="token" type="hidden" value="123456"/>
<input name="sign" type="hidden" value="7890="/>
<input name="system" type="hidden" value="Application_1"/>
<input name="action" type="hidden" value="GO_SYSTEM"/><h1><a href="javascript: document.f0.submit()">Application 1</a></h1>
<div id="desc0"><h2>Application 1</h2></div>
</form>
</td>
<td width="12px"></td>
<td width="394px">
<img alt="" height="16" src="authorizator/vineta.item.gif" title="" width="16"/>
<form action="" enctype="application/x-www-form-urlencoded" method="post" name="f1">
<input name="token" type="hidden" value="123456"/>
<input name="sign" type="hidden" value="7890"/>
<input name="system" type="hidden" value="Application_2"/>
<input name="action" type="hidden" value="GO_SYSTEM"/><h1><a href="javascript: document.f1.submit()">Application 2</a></h1>
<div id="desc1"><h2>Application 2</h2></div>
</form>
</td>
我需要查看应用程序列表作为输入选项,例如:
Press the number of the application to enter:
1.- Application 1
2.- Application 2
3.- Application 3
谢谢!