Mechanize Submit Form Error: Insufficient items with name '10427'

Posted by maneh on Stack Overflow See other posts from Stack Overflow or by maneh
Published on 2014-06-07T03:21:15Z Indexed on 2014/06/07 3:24 UTC
Read the original article Hit count: 125

Filed under:
|
|
|

I'm trying to submit a form with Mechanize, I have tried different ways, but the problem persists. Can anyone help me on this. Thank you in advance!

This is the form I want to submit: http://www.stpairways.st/

This is the code that I'm using:

def stp_airways(url):
    import re
    import mechanize

    br = mechanize.Browser()
    br.open(url)
    print br.title()
    br.select_form(name = "frmbook")
    br.form['TypeTrajet'] = ["1"]
    br.form['id_depart'] = ["11967"]
    br.form['id_arrivee'] = ["10427"]
    br.form['txtDateAller'] = "5/7/2014"
    br.form['txtDateRetour'] = "12/7/2014"
    br.form['TypePassager1u1000r0b1'] = ["1"]
    br.form['TypePassager2u1000r0b1'] = ["0"]
    br.form['TypePassager3u1000r0b1'] = ["0"]
    br.form['CodeIsoDeviseClient'] = ["17,20,23,24,25,26,27,28,29,30,31,33,34,36,37,64,65,67,68,70,73,80,81,95,96,103,147,151,152,159,160,162,169,170TP1TPF"]
    br.form['CodeIsoDeviseClient'] = ["EUR"]

    # submit
    response1 = br.submit()
    print response1.read()

© Stack Overflow or respective owner

Related posts about python

Related posts about forms