Home | History | Annotate | Download | only in rpm_control_system
      1 # Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 import urllib
      5 
      6 import dli
      7 
      8 
      9 class Powerswitch(dli.powerswitch):
     10     """
     11     This class will utilize urllib instead of pycurl to get the web page info.
     12     """
     13 
     14 
     15     def geturl(self,url='index.htm') :
     16         self.contents=''
     17         path = 'http://%s:%s@%s:80/%s' % (self.userid,self.password,
     18                                           self.hostname,url)
     19         web_file = urllib.urlopen(path)
     20         if web_file.getcode() != 200:
     21             return None
     22         self.contents = web_file.read()
     23         return self.contents
     24