" FormNotFoundError:没有匹配名称的表单......"与Mechanize

时间:2015-04-24 00:33:32

标签: python web-scraping mechanize

这是我的代码:

import mechanize

br = mechanize.Browser()
br.set_handle_robots(False)
br.set_handle_refresh(False)
br.addheaders = [('User-agent', 'Firefox')]

fitchsite = "https://www.fitchratings.com/jsp/general/login/LoginController.faces"
br.open(fitchsite)

br.select_form(name="loginForm")
br.form["loginForm:userName"] = "my username"
br.form["loginForm:password"] = "my password"

r = br.submit()
s = r.read()

print s

我试图登录fitch的网站,但获得formnotfounderror,虽然表格肯定在那里并且有上述名称。

0 个答案:

没有答案