我目前正在尝试登录
https://customersso1.fortinet.com/saml-idp/login/?next=
在登录后,头指向https://support.fortinet.com/Information/ProductLifeCycle.aspx
和刮除其中的所有表格
我尝试了各种方法,并确定robobrowser是理想的选择。但是,该网站有CSRF中间件令牌,不允许我登录
此外,Robobrowser中的get_form()函数不会获取用户名和密码字段供我登录。(登录页面中只有一个表单)我已经提供了凭据作为其公共信息,任何人都可以创建一个ID来访问该信息
import re
from robobrowser import RoboBrowser
from bs4 import BeautifulSoup
br = RoboBrowser()
br.open('https://customersso1.fortinet.com/saml-idp/login/?next=')
form = br.get_form()
form["id_username"] = "csmcoe.global@global.ntt"
form["id_password"] = 'Csmcoe@123'
#form["csrffieldname"] = 'X2fOGlgm0lBH60k2SqPiJ5BkFv7lRzKo'
br.submit_form(form)
当您解析表单时
form.parsed
你得到(当你检查网页时,你会注意到表单中的div容器,但当你刮去它时,你不会注意到。因为没有用户名元素,我无法通过表单登录)
<form action="" autocomplete="off" id="login_form" method="post">
<input name="csrfmiddlewaretoken" type="hidden" value="tzDXaug8hGlNO7h6oDDU3tel80mdA9AZ"/>
<input name="next" type="hidden" value="/"/>
<div class="container" id="container"></div>
</form>
此外,除robobrowser之外的任何其他方式也值得赞赏。谢谢大家!
试试这个
相关问题 更多 >
编程相关推荐