当前位置: 首页>>代码示例>>Python>>正文


Python Browser.set_all_readonly方法代码示例

本文整理汇总了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())
开发者ID:flyeven,项目名称:scraperwiki-scraper-vault,代码行数:32,代码来源:dividendexdividenddate.py

示例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))
开发者ID:prabh27,项目名称:Travel-Portal,代码行数:30,代码来源:default.py

示例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)
开发者ID:prabh27,项目名称:Travel-Portal,代码行数:17,代码来源:default.py


注:本文中的mechanize.Browser.set_all_readonly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。