Python RoboBrowser 错误

Python RoboBrowser error

我正在使用 RoboBrowser 使用此代码登录网站:

import re
from robobrowser import RoboBrowser
bra=RoboBrowser()
bra=open("http://webpage.com")
form=bra.get_form()
form['user']='test'
form['password']='pass'
bra.submit_form(form)

但是我得到这个错误:

OSError: [Errno 22] 无效参数:'http://webpage.com'

我已经尝试了与该网站相关的所有网址,但我总是遇到同样的错误。也许我可以使用另一个图书馆或其他东西。我正在使用 Windows 10 并使用 Python 3.6

您似乎正在尝试访问 open method of the bra variable (RoboBrowser). The problem is that you are using an equals sign and are actually calling the standard library built-in function open。将等号更改为句点应该可以解决此问题。

bra=open("http://webpage.com")
   ^
   v
bra.open("http://webpage.com")