import mechanize
url = 'http://www.cpso.on.ca/docsearch/'
request = mechanize.Request(url)
response = mechanize.urlopen(request)
forms = mechanize.ParseResponse(response, backwards_compat=False)
response.close()
form = forms[0]
form['ctl00$ContentPlaceHolder1$MainContentControl1$ctl00$txtLastName'
    ] = 'Smith'
form['ctl00$ContentPlaceHolder1$MainContentControl1$ctl00$txtPostalCode'
    ] = 'K1H'
print(mechanize.urlopen(form.click()).read())
Sending form data to aspx page