我希望有人可以帮我解决我的小问题,或者至少让我朝着正确的方向前进。我正在寻找一种能够使用python脚本自动登录德国电信热点的解决方案。
我认为urlib是我想要的图书馆。我的机械化尝试失败,因为页面javascript需要。在帖子Submitting form (Python)中,我找到了如何解决它,但是现在我没有得到正确的值来发送。
<div id="hotspotLoginBox" class="Takt">
<form id="f_login" name="f_login" method="post" action="https://rlp.telekom.de/wlan/rlp.do" enctype="application/x-www-form-urlencoded">
<input name="t" type="hidden" value="fiebx=E;AD;A;C4;"/>
<input id="f_login_submit" name="f_login_submit" type="submit" style="display:none" tabindex="999" />
<!--<tm:submit tabindex="999" image="" style="display:none" id="f_login_submit"></tm:submit>--> <script type="text/javascript">
/* <![CDATA[ */
if( jQuery('#Tloginerrmsgbox span.Terrmsg').first().children().length != 0 ) {
jQuery('#Tloginerrmsgbox').removeClass('hide');
jQuery('.borderBottom').removeClass('borderBottom');
jQuery('.fonTabs').removeClass('marginBottom');
}
/* ]]> */
</script>
<div class="Tinp withIcon ">
<label for="username">E-Mail Adresse oder Benutzername</label>
<input type="text" maxlength="72" value="" autocapitalize="off" name="username" id="username" tabindex="10" class="large" />
<div title="Fallback Tooltip (no JS)" id="usernameTooltipWrapper_DSK" class="Tnomob tooltip top-left">
<div class="font-size-default tooltip-icon icon" >i</div>
<div class="tooltip-content hide" id="user_tooltip_DSK">
<p><br/><a href="/TD/de_DE/web/help_and_service/how_it_works.html#a0" target="_blank">Telekom Festnetz-Kunden mit HotSpot Basic / HotSpot Flat</a><br/><br/><a href="/TD/de_DE/web/help_and_service/how_it_works.html#a0" target="_blank">Telekom Mobilfunk-Kunden mit HotSpot Basic / Hot Spot Flat</a><br/><br/><a href="/TD/de_DE/web/help_and_service/how_it_works.html#a0" target="_blank">Kunden mit HotSpot Konto / HotSpot Pass</a><br/><br/></p> <p class="Tartsp"> </p> <p class="Tartsp"> </p> </div>
</div>
<div title="Fallback Tooltip (no JS)" id="usernameTooltipWrapper_MOB" class="Tismob tooltip left">
<div class="font-size-default tooltip-icon icon" >i</div>
<div class="tooltip-content hide" id="user_tooltip_MOB">
<p><br/><a href="/TD/de_DE/web/help_and_service/how_it_works.html#a0" target="_blank">Telekom Festnetz-Kunden mit HotSpot Basic / HotSpot Flat</a><br/><br/><a href="/TD/de_DE/web/help_and_service/how_it_works.html#a0" target="_blank">Telekom Mobilfunk-Kunden mit HotSpot Basic / Hot Spot Flat</a><br/><br/><a href="/TD/de_DE/web/help_and_service/how_it_works.html#a0" target="_blank">Kunden mit HotSpot Konto / HotSpot Pass</a><br/><br/></p> <p class="Tartsp"> </p> <p class="Tartsp"> </p> </div>
</div>
<div class="right"> <a href="/FON_EXT/de_DE/web/help_and_service/forgot_password.html"> Passwort vergessen?
</a> </div>
</div>
<div class="Tinp withIcon ">
<label for="password">Passwort</label>
<input name="password" id="password" type="password" tabindex="20" autocomplete="off" class="large" title="no description available" />
<div title="Fallback Tooltip (no JS)" id="pwdTooltipWrapper_MOB" class="Tismob tooltip left">
<div class="font-size-default tooltip-icon icon" >i</div>
<div class="tooltip-content hide" id="pwd_tooltip_MOB">
<p>Bitte beachten Sie die Groß- und Kleinschreibung.</p></div>
</div>
<div title="Fallback Tooltip (no JS)" id="pwdTooltipWrapper_DSK" class="Tnomob tooltip top-left">
<div class="font-size-default tooltip-icon icon" >i</div>
<div class="tooltip-content hide" id="pwd_tooltip_DSK">
<p>Bitte beachten Sie die Groß- und Kleinschreibung.</p></div>
</div>
</div>
<div class="Tclr"></div>
<p class="Tlogchk">
<input type="hidden" name="HSPNAME" value="FON:DE" /><input type="hidden" name="VNPNAME" value="FON:DE" /><input type="hidden" name="WISPURL" value="https%3A%2F%2Ftelekom.portal.fon.com%2FSRCDTA01%2Ffon%2F24f50d843397a4de51ed6e3535dae5eb168bd9e1%3Fres%3Dvnp-login%26nasid%3DD4-21-22-E6-F2-50%26uamip%3D172.17.2.1%26uamport%3D3990%26mac%3D40-A5-EF-94-B8-A8%26challenge%3Db66a8c41cc8a8f12e1049126a402ab1a%26HSPNAME%3DFON%253ADE%26VNPNAME%3DFON%253ADE%26LOCATIONNAME%3DFON%253ADE%26userurl%3Dhttp%253A%252F%252F%252F%26strAGB%3D1%26LOCATIONID%3DFON%253ADE%26LANGUAGE%3Dde_DE%26tab%3D2" /><input type="hidden" name="WISPURLHOME" value="https%3A%2F%2Ftelekom.portal.fon.com%2FSRCDTA01%2Ffon%2F24f50d843397a4de51ed6e3535dae5eb168bd9e1%3Fres%3Dnotyet%26nasid%3DD4-21-22-E6-F2-50%26uamip%3D172.17.2.1%26uamport%3D3990%26mac%3D40-A5-EF-94-B8-A8%26challenge%3Db66a8c41cc8a8f12e1049126a402ab1a%26userurl%3Dhttp%253A%252F%252F%252F%26ip%3D172.17.2.2%26called%3DD4-21-22-E6-F2-50%26sessionid%3D59b2d19100000001%26md%3DEE9B6397622814B5AEFF8DE9B41E94C8%26tab%3D2" /><input type="hidden" name="LOCATIONNAME" value="FON:DE" /><input type="hidden" name="LOCATIONID" value="FON:DE" /><input type="hidden" name="LANGUAGE" value="de_DE" /> <input type="hidden" name="realm" id="rrid" value="t-mobile.net" />
<input type="hidden" name="roamRealm" id="rrid" value="t-mobile.net" /><input jsfc="tm:input" type="checkbox" class="Tchkb" id="terms_conditions" name="terms_conditions" checked="checked" style="display: none;" />
<input id="terms_conditions" type="checkbox" name="strAGB" value="AGB" checked="checked" style="display: none;" class="Tchkb" />
<input id="payment_advice" type="checkbox" name="strHinweis" value="Zahlungsbedingungen" checked="checked" style="display: none;" class="Tchkb" /> Ich akzeptiere die <a href="/FON_EXT/downloads/legal_notice_de,tid=da.pdf" target="_blank">Nutzunsbedingungen.</a> </p>
<p class="Tftn">Ich akzeptiere die <a href="/FON_EXT/de_DE/web/AboutFON/agb_de.html">AGB und Preise zu HotSpot</a></p>
<div class="Tctr">
<span class="Tbutt Tbuttm"> <a id="btnCheckPriceShock" tabindex="40" href="#" class="Tnomob button embossed magenta large center">Verbindung herstellen</a>
<a tabindex="40" onclick="jQuery('#btnCheckPriceShock').click()" class="Tismob button embossed large magenta center">Verbindung herstellen</a> </span>
</div>
<input jsfc="tm:input" type="checkbox" id="clear_session" name="clear_session" checked="checked" style="display: none;" />
</form>
</div>
<div id="fonLoginBox" class="TnoAkt">
<form action="https://telekom.portal.fon.com/SRCDTA01/fon/24f50d843397a4de51ed6e3535dae5eb168bd9e1?res=login&nasid=D4-21-22-E6-F2-50&uamip=172.17.2.1&uamport=3990&mac=40-A5-EF-94-B8-A8&challenge=b66a8c41cc8a8f12e1049126a402ab1a&userurl=http%3A%2F%2F%2F&tab=2" name="login_fon" id="f_fon_login" method="post">
<input id="f_fon_login_submit" name="f_fon_login_submit" type="submit" style="display:none" tabindex="5" />
<input id="f_fon_login_tab" name="tab" type="hidden" value="2" />
<div id="Tloginerrmsgbox" style="display:none;border-top: 1px solid #DCDCDC;">
<p>
<span id="fonLoginError" class="Terrmsg">
Ihre HotSpot Sitzung wurde beendet und Sie wurden erfolgreich abgemeldet.<br />
</span>
</p>
<div style="top: 82px;" class="Tlyrarr"></div>
</div>
<div class="fon_login_selector">
<select id="fon_selector" class="tk-dropdown tooltip" name="partner">
<option class="fon option" value="">Partner wählen</option>
<option class="fon option" value="oiwifi">Oi</option><option class="fon option" value="belgacom">Proximus</option><option class="fon option" value="bt">BT</option><option class="fon option" value="netia">Netia</option><option class="fon option" value="softbank">Softbank</option><option class="fon option" value="nos">NOS</option><option class="fon option" value="fon" selected>Fon</option><option class="fon option" value="croatia">Hrvatski Telekom</option><option class="fon option" value="sfr">SFR</option><option class="fon option" value="ote">COSMOTE</option><option class="fon option" value="mweb">MWEB</option><option class="fon option" value="rtc">Telekom Romania</option><option class="fon option" value="kpn">KPN</option><option class="fon option" value="telstra">Telstra</option><option class="fon option" value="vfes">Vodafone España</option><option class="fon option" value="vfit">Vodafone Italia</option> </select>
</div>
<div class="Tinp withIcon ">
<label for="username">E-Mail Adresse oder Benutzername</label>
<input id="fon_username" type="text" name="USERNAME" value="" tabindex="10" class="large" />
<div title="Fallback Tooltip (no JS)" id="usernameTooltipWrapper_DSK" class="Tnomob tooltip top-left">
<div class="font-size-default tooltip-icon icon" >i</div>
<div class="tooltip-content hide" id="user_tooltip_DSK">
<p>Ihr Fon Benutzername ist die E-Mail Adresse mit der Sie sich bei Fon registriert haben.</p></div>
</div>
<div title="Fallback Tooltip (no JS)" id="usernameTooltipWrapper_MOB" class="Tismob tooltip left">
<div class="font-size-default tooltip-icon icon" >i</div>
<div class="tooltip-content hide" id="user_tooltip_MOB">
<p>Ihr Fon Benutzername ist die E-Mail Adresse mit der Sie sich bei Fon registriert haben.</p></div>
</div>
</div>
<div class="Tinp withIcon ">
<div class="right">
<a style="color:#FAB033" href="https://recover-password.fon.com">Passwort vergessen?</a>
</div>
<label for="password">Passwort</label>
<input id="fon_password" type="password" name="PASSWORD" value="" tabindex="20" autocomplete="off" class="large" title="no description available" />
<div title="Fallback Tooltip (no JS)" id="pwdTooltipWrapper_MOB" class="Tismob tooltip left">
<div class="font-size-default tooltip-icon icon" >i</div>
<div class="tooltip-content hide" id="pwd_tooltip_MOB">
<p>Bitte Groß- und Kleinschreibung beachten.</p></div>
</div>
<div title="Fallback Tooltip (no JS)" id="pwdTooltipWrapper_DSK" class="Tnomob tooltip top-left">
<div class="font-size-default tooltip-icon icon" >i</div>
<div class="tooltip-content hide" id="pwd_tooltip_DSK">
<p>Bitte Groß- und Kleinschreibung beachten.</p></div>
</div>
</div>
<input type="hidden" name="HSPNAME" value="FON:DE" /><input type="hidden" name="VNPNAME" value="FON:DE" /><input type="hidden" name="WISPURL" value="https%3A%2F%2Ftelekom.portal.fon.com%2FSRCDTA01%2Ffon%2F24f50d843397a4de51ed6e3535dae5eb168bd9e1%3Fres%3Dvnp-login%26nasid%3DD4-21-22-E6-F2-50%26uamip%3D172.17.2.1%26uamport%3D3990%26mac%3D40-A5-EF-94-B8-A8%26challenge%3Db66a8c41cc8a8f12e1049126a402ab1a%26HSPNAME%3DFON%253ADE%26VNPNAME%3DFON%253ADE%26LOCATIONNAME%3DFON%253ADE%26userurl%3Dhttp%253A%252F%252F%252F%26strAGB%3D1%26LOCATIONID%3DFON%253ADE%26LANGUAGE%3Dde_DE%26tab%3D2" /><input type="hidden" name="WISPURLHOME" value="https%3A%2F%2Ftelekom.portal.fon.com%2FSRCDTA01%2Ffon%2F24f50d843397a4de51ed6e3535dae5eb168bd9e1%3Fres%3Dnotyet%26nasid%3DD4-21-22-E6-F2-50%26uamip%3D172.17.2.1%26uamport%3D3990%26mac%3D40-A5-EF-94-B8-A8%26challenge%3Db66a8c41cc8a8f12e1049126a402ab1a%26userurl%3Dhttp%253A%252F%252F%252F%26ip%3D172.17.2.2%26called%3DD4-21-22-E6-F2-50%26sessionid%3D59b2d19100000001%26md%3DEE9B6397622814B5AEFF8DE9B41E94C8%26tab%3D2" /><input type="hidden" name="LOCATIONNAME" value="FON:DE" /><input type="hidden" name="LOCATIONID" value="FON:DE" /><input type="hidden" name="LANGUAGE" value="de_DE" /> <div class="fonButton Tctr">
<span class="Tbutt Tbuttm">
<a tabindex="40" id="fon_submit_button_dsk" onclick="jQuery('#f_fon_login').submit();return false;" href="javascript:submit()" class="Tnomob button embossed large center">Verbindung herstellen</a>
<a tabindex="40" id="fon_submit_button" onclick="jQuery('#f_fon_login').submit();return false;" href="javascript:submit()" class="Tismob button embossed large center">Verbindung herstellen</a>
</span>
</div>
<div class="fon_logBox_branding Tnomob" >
<img src="/shared/static_fon/imgs/desktop_fon_logo_loginbox,tid=da.png" alt="FON" />
</div>
<div class="fon_logBox_branding Tismob" >
<img src="/shared/static_fon/imgs/mob_fon_logo,tid=da.png" alt="FON"/>
</div>
</form>
</div>
</div>
&#13;
有人能给我一个好的暗示吗? 谢谢。
答案 0 :(得分:0)