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


Python Browser.form['legend_steps']方法代码示例

本文整理汇总了Python中mechanize.Browser.form['legend_steps']方法的典型用法代码示例。如果您正苦于以下问题:Python Browser.form['legend_steps']方法的具体用法?Python Browser.form['legend_steps']怎么用?Python Browser.form['legend_steps']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mechanize.Browser的用法示例。


在下文中一共展示了Browser.form['legend_steps']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _mapgen_speed_fired

# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import form['legend_steps'] [as 别名]
    def _mapgen_speed_fired(self):
        test_dir(join(self.dirname, 'gps_vis'))
        br = Browser()
        # Ignore robots.txt
        br.set_handle_robots( False )

        # Google demands a user-agent that isn't a robot
        br.addheaders = [('User-agent', 'Firefox')]
            
        resp1 = br.open( "http://www.gpsvisualizer.com/map_input" )
         
        # Select the search box and search for 'foo'
        br.select_form( name='main' )

        br.form['width'] = '870'
        br.form['height'] = '600'
        br.set_value(['google_openstreetmap'], name='bg_map')
        br.set_value(['speed'], name='trk_colorize')
        br.form['legend_steps'] = '10'
        br.add_file(open(self.filename_converted), "text/plain", self.filename_converted, name='uploaded_file_1')
         
        # Get the search results
        resp2 = br.submit()
         
        resp = None
        for link in br.links():
            siteMatch = re.compile( 'download/' ).search( link.url )
            if siteMatch:
                resp = br.follow_link( link )
                break

        # Print the site
        content = resp.get_data()

        ofile = open(join(self.dirname, 'gps_vis', 'map_speed.html'),'w')
        ofile.write(content)
        ofile.close()
        br.close()

        print 'map generated (speed color)'
开发者ID:kelidas,项目名称:scratch,代码行数:42,代码来源:report_generator.py

示例2: _profilegen_fired

# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import form['legend_steps'] [as 别名]
    def _profilegen_fired(self):
        test_dir(join(self.dirname, 'gps_vis'))
        br = Browser()
        # Ignore robots.txt
        br.set_handle_robots( False )

        # Google demands a user-agent that isn't a robot
        br.addheaders = [('User-agent', 'Firefox')]
            
        # Retrieve the Google home page, saving the response
        resp1 = br.open( "http://www.gpsvisualizer.com/profile_input" )
         
        # Select the search box and search for 'foo'
        br.select_form( name='main' )

        br.form['width'] = '870'
        br.form['height'] = '250'
        br.form['legend_steps'] = '10'
        br.add_file(open(self.filename_converted), "text/plain", self.filename_converted, name='uploaded_file_1')
         
        # Get the search results
        resp2 = br.submit()
         
        resp = None
        for link in br.links():
            siteMatch = re.compile( 'download/' ).search( link.url )
            if siteMatch:
                resp = br.follow_link( link )
                break

        # Print the site
        content = resp.get_data()

        ofile = open(join(self.dirname, 'gps_vis', 'profile.png'),'wb')
        ofile.write(content)
        ofile.close()
        br.close()

        print 'profile generated'
开发者ID:kelidas,项目名称:scratch,代码行数:41,代码来源:report_generator.py


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