Python mechanize引发BrowserStateError
我有以下代码:Python mechanize引发BrowserStateError,python,mechanize,Python,Mechanize,我有以下代码: br = mechanize.Browser() br._factory.is_html = True br.form = mechanize._form.ParseString('<form method="post"</form>', 'http://localhost/post.php')[1] br.form.new_control('text', 'test',{'value':'something'}) br.form.fixup() br.sub
br = mechanize.Browser()
br._factory.is_html = True
br.form = mechanize._form.ParseString('<form method="post"</form>', 'http://localhost/post.php')[1]
br.form.new_control('text', 'test',{'value':'something'})
br.form.fixup()
br.submit()
br=mechanize.Browser()
br.\u factory.is\u html=True
br.form=mechanize.\u form.ParseString(“显然,mechanize
要求您有实际响应才能提交表单:
def viewing_html(self):
"""Return whether the current response contains HTML data."""
if self._response is None:
raise BrowserStateError("not viewing any document")
return self._factory.is_html
()