Python 机械化以提交和读取响应

Python 机械化以提交和读取响应,python,response,mechanize,Python,Response,Mechanize,我在python中使用mechanize提交表单并打印响应,但它似乎不起作用 import mechanize # The URL to this service URL = 'http://sppp.rajasthan.gov.in/bidsearch.php' def main(): # Create a Browser instance b = mechanize.Browser() # Load the page b.open(URL) #

我在python中使用mechanize提交表单并打印响应,但它似乎不起作用

import mechanize

# The URL to this service
URL = 'http://sppp.rajasthan.gov.in/bidsearch.php'


def main():
    # Create a Browser instance
    b = mechanize.Browser()
    # Load the page
    b.open(URL)
    # Select the form
    b.select_form(nr=0)
    # Fill out the form
    b['ddlfinancialyear'] = '2015-2016'
    b.submit()
    b.response().read()

我想做的是使用url“sppp.rajasthan.gov.in/bidsearch.php”提交一份表格;,当通过尝试将值“2015-2016”传递给“ddfinancialyear”控件提交表单时,应返回另一页作为响应,我没有收到任何输出

在阅读之前,尝试分配b.submit:

S = b.submit()
S.read()
在阅读之前,请尝试分配b.submit:

S = b.submit()
S.read()

你需要确切地告诉我们什么似乎不起作用。发生了什么,你期望发生什么?我想做的是使用url提交表单,当通过尝试将值“2015-2016”传递给“ddfinancialyear”控件来提交表单时,应返回另一个页面作为响应,我没有收到任何输出。您是否尝试检查response.code的内容?您需要准确地告诉我们什么似乎不起作用。发生了什么,您希望发生什么?我正在尝试使用url提交表单,当表单通过尝试将值“2015-2016”传递给“ddfinancialyear”控件提交时,另一个页面应作为响应返回,并且我没有得到任何输出。您是否尝试检查响应。代码显示了什么?