我尝试使用Mechanize提交表单,我尝试了不同的方法,但问题仍然存在。谁可以帮我这个事。提前谢谢!
这是我要提交的表单:http://www.stpairways.st/
这是我正在使用的代码:
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()
答案 0 :(得分:1)
检查ID 10427和119667之间是否有航班 和 表格提交使用
br.submit(name ='放置提交按钮的id',label ='及其标签在这里')