python mechanicalsoup redirection issue

跟風遠走 提交于 2019-12-11 04:26:43

问题


guys, actually I have a problem in my code and the redirection feature in my router, after I wrote the code which able to find the form and login into the router I faced a problem that after the login using the login.cgi the router redirects the link into something like http://192.168.1.2/index.asp;session_id=2dfa2490ad2e26a3d073edfdae7d0f45 what I could understand that it shows the session id in the link and I need help to make my code understands and gets the link I tried many times using browser.get_url() but it shows http://192.168.1.2/login.cgi

thank you guys

def wifi_pass_changer():
   username = 'admin'
   password = 'admin'
   url = "http://192.168.1.2/"
   browser = mechanicalsoup.StatefulBrowser()
   browser.open(url)
   browser.select_form('form[action="login.cgi"]')
   browser["http_username"] = username
   browser["http_passwd"] = password
   response = browser.submit_selected()

来源:https://stackoverflow.com/questions/46893406/python-mechanicalsoup-redirection-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!