本文整理汇总了Python中mechanize.Browser.set_all_readonly方法的典型用法代码示例。如果您正苦于以下问题:Python Browser.set_all_readonly方法的具体用法?Python Browser.set_all_readonly怎么用?Python Browser.set_all_readonly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mechanize.Browser
的用法示例。
在下文中一共展示了Browser.set_all_readonly方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_data
# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import set_all_readonly [as 别名]
def get_data ():
html = scraperwiki.scrape (edd_url)
process_ex_dividend_data (html)
br = Browser()
br.set_handle_robots (False)
br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
br.open (edd_url)
links = {}
for link in br.links():
if link.text in ['2', '3', '4']:
links [link.text] = link.url
for k, link in links.items():
m = re.search (edd_pat, link)
br = Browser()
br.set_handle_robots (False)
br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
br.open (edd_url)
br.select_form(nr=0)
br.set_all_readonly(False)
br["__EVENTTARGET"] = m.group(1)
br["__EVENTARGUMENT"] = ''
for c in br.controls:
if c.type == 'submit':
c.disabled = True
response = br.submit()
process_ex_dividend_data (response.read())
示例2: fare
# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import set_all_readonly [as 别名]
def fare():
br=Browser()
br.open("http://www.indianrail.gov.in/fare_Enq.html")
br.select_form(nr=0)
ab=[]
ab.append(request.args(5))
br.set_all_readonly(False)
br['lccp_trnno']=str(request.args(0))
br['lccp_day']=str(request.args(1))
br['lccp_month']=str(request.args(2))
br['lccp_srccode']=str(request.args(3))
br['lccp_dstncode']=str(request.args(4))
br['lccp_classopt']=ab
br['lccp_age']=['30']
br['lccp_conc']=['ZZZZZZ']
response=br.submit()
content=response.read()
a=re.findall('<TR class="heading_table_top">.*</TABLE>',content,re.DOTALL)
for f in a:
w=1
soup1=BeautifulSoup(f)
soup1=soup1.table
qwer=request.args(0).split(' ')
form=SQLFORM.factory(
Field('t',label='Train Schedule',requires=IS_IN_SET(qwer)))
if form.accepts(request.vars,session):
redirect(URL(r=request,f='route',args=(form.vars.t)))
return dict(soup1=XML(soup1),a=request.args(0))
示例3: route
# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import set_all_readonly [as 别名]
def route():
br=Browser()
br.open("http://www.indianrail.gov.in/inet_trn_num.html")
br.select_form(nr=0)
br.set_all_readonly(False)
br['lccp_trnname']=str(request.vars.a)
response=br.submit()
content=response.read()
route=re.findall('<TR class="heading_table_top">.*</TABLE>',content,re.DOTALL)
f=''
for f in route:
a=1
soup=BeautifulSoup(f)
soup=soup.table
return dict(soup=soup)