[英]Using Machanize to access password protected site
Im trying to get into a site using machanize but when i run my script its still just giving me the source for the homepage and not for the actual site 我正在尝试使用machanize进入网站,但是当我运行脚本时,它仍然只是为我提供了首页的来源,而不是实际网站的来源
here is the code 这是代码
from mechanize import Browser
USERNAME = "my username"
PASSWORD = "my pass"
LOGIN_PAGE = "https://ps.rsd.edu/public/"
browser = Browser()
browser.open( LOGIN_PAGE )
browser.select_form( nr=0 )
browser['pw'] = PASSWORD
response = browser.submit()
print response.read()
please help! 请帮忙!
Your forgot to enter username. 您忘记输入用户名。 It should be entered the same as password.
输入的密码应与密码相同。 Example:
例:
from mechanize import Browser
USERNAME = "my username"
PASSWORD = "my pass"
LOGIN_PAGE = "https://ps.rsd.edu/public/"
browser = Browser()
browser.open( LOGIN_PAGE )
browser.select_form( nr=0 )
browser['account'] = USERNAME
browser['pw'] = PASSWORD
response = browser.submit()
print response.read()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.