本文整理汇总了Python中mechanize.Browser.form['start_date_day']方法的典型用法代码示例。如果您正苦于以下问题:Python Browser.form['start_date_day']方法的具体用法?Python Browser.form['start_date_day']怎么用?Python Browser.form['start_date_day']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mechanize.Browser
的用法示例。
在下文中一共展示了Browser.form['start_date_day']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Browser
# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import form['start_date_day'] [as 别名]
url = 'http://www2.tceq.texas.gov/oce/waci/index.cfm?fuseaction=home.main'
# Create a new browser object and open the URL
br = Browser()
br.set_handle_robots(False)
br.open(url)
########## STEP 2: Select and fill out the appropriate form ##########
# Select the appropriate form, which we'll find by looking in Chrome
br.select_form("county_search_form")
# Each control can be set. Dropdown lists are handled as lists, text fields take text
br.form['county_select'] = ['111111111111180']
br.form['start_date_month'] = ['1']
br.form['start_date_day'] = ['1']
br.form['start_date_year'] = ['2014']
br.form['end_date_month'] = ['1']
br.form['end_date_day'] = ['30']
br.form['end_date_year'] = ['2014']
# Submit the form
br.submit()
########## STEP 3: Grab and parse the HTML ##########
soup = BeautifulSoup(br.response())
complaints = soup.find('table', class_='waciList')