我用Python编写了一个脚本Mechanize,它应该在特定的网页上自动注册。在
代码:
import mechanize
br = mechanize.Browser()
response = br.open("https://arkhamnetwork.org/community/register")
br.addheaders = [("User-agent","Mozilla/5.0")]
gitbot = br.open("https://arkhamnetwork.org/community/register")
br.select_form(nr=1)
br.set_all_readonly(False)
br.form.set_value("test", nr=0)
br.method = "POST"
response = br.submit()
print response.geturl('http://arkhamnetwork.org/community/register/register')
每当我执行脚本时,都会出现以下错误:
TypeError: geturl() takes exactly 1 argument (2 given)
出什么问题了?在
有一些(相当初级的)文档here告诉您如何使用
geturl()
方法:通常,当错误告诉您传递的参数太多时,通常是因为您忘记了这样一个事实:对象的实例方法隐式传递
self
作为第一个参数。在相关问题 更多 >
编程相关推荐