我正在尝试使用Mechanize库登录。这是我运行时得到的输出
for f in br.forms():
print f
输出
<login_form1 POST https://www.box.com/login application/x-www-form-urlencoded
<TextControl(login=)>
<PasswordControl(password=)>
<HiddenControl(_pw_sql=) (readonly)>
<CheckboxControl(remember_login=[*on])>
<HiddenControl(__login=1) (readonly)>
<HiddenControl(reg_step=) (readonly)>
<HiddenControl(submit1=1) (readonly)>
<HiddenControl(folder=) (readonly)>
<HiddenControl(skip_framework_login=) (readonly)>
<HiddenControl(login_or_register_mode=login) (readonly)>
<HiddenControl(new_login_or_register_mode=) (readonly)>
<SubmitControl(<None>=) (readonly)>>
<google_apps_login_form POST https://www.box.com/sso/google_apps application/x-www-form-urlencoded
<TextControl(google_apps_domain=Enter Domain Name)>
<CheckboxControl(google_apps_non_enterprise=[on])>>
现在登录我所做的页面,
br.form['login']='USERNAME'
br.form['password']='PASSWORD'
但是回复显示我还没有登录。
我在某个地方出错了?
答案 0 :(得分:2)
从它的外观来看,你错过了br.submit()
(似乎你没有跳过br.select_form(nr=0)
,登录表格)。只有在您登录后才能使用。基本上您只需填写用户名和密码,但没有按回车键。