maneh
maneh

Reputation: 11

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

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()

Upvotes: 1

Views: 411

Answers (1)

Vipul Divyanshu
Vipul Divyanshu

Reputation: 196

Check if there is a flight between id 10427 and 119667 and for form submit use

br.submit(name='Place the id of the submit button',label='And its label here')

Upvotes: 1

Related Questions