为什么我的RoboBrowser表单提交不起作用?

时间:2019-06-01 19:06:32

标签: python python-3.x robobrowser

我正在使用RoboBrowser将表单数据发布到php网站。为什么我会遇到“ robobrowser.exceptions.InvalidSubmitError”错误?

我尝试了许多在网络上共享的解​​决方案,但没有任何效果。

import re
from robobrowser import RoboBrowser
import requests

br = RoboBrowser()
br.open("https://bombayhighcourt.nic.in/case_query.php")
form = br.get_form()
print(form)
# print(form['m_hc'].value)
form['m_hc'] = '01'
form['m_sideflg'] = 'C'
form['m_sr'] = 'R'
form['m_skey'] = 'AO'
form['m_no'] = ''
form['m_yr'] = ''
# form['submit1'] = 'Search By Case No'
form['frmdate'] = '01-06-2018'
form['todate'] = '01-06-2019'
form['submit11'] = 'List By Case Type'
form.action = 'https://bombayhighcourt.nic.in/case_query.php'
print(len(list(form.submit_fields.items(multi=True))))
print(br.session.cookies['PHPSESSID']) # BAh7Bzo...
print(br.session.headers['User-Agent']) # a python robot
# form.serialize()
print(form)
br.submit_form(form)
# br.submit_form(form, submit11)
# submit_field = form.action
# submit_field.value = 'List By Case Type'
# br.submit_form(form, submit=submit_field)
# src = str(br.parsed())
# print(str)
# form['password'] = "FILL_PASSWORD_IN"
# br.submit_form(form)
# src = str(br.parsed())
# start = '<li class="header-bal">Earned: '
# end = '</li>'
# result = re.search('%s(.*)%s' % (start, end), src).group(1)
# print(result)

我遇到了错误。请支持:

    raise exceptions.InvalidSubmitError()
    robobrowser.exceptions.InvalidSubmitError

0 个答案:

没有答案