0

我正在尝试使用库 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'

但是响应仍然显示我还没有登录。

我在某个地方出错了吗?

4

1 回答 1

2

好吧,从外观上看,您错过了br.submit()(看来您没有跳过br.select_form(nr=0)登录表单)。只有在您登录之后。基本上您只是填写了您的用户名和密码,但没有按回车键。

于 2012-06-08T05:06:11.753 回答