blob: f14aeaa9fe52d7f054dfe3aedd5ccf4de290a609 [file] [log] [blame] [edit]
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import urllib
import dli
class Powerswitch(dli.powerswitch):
"""
This class will utilize urllib instead of pycurl to get the web page info.
"""
def geturl(self,url='index.htm') :
self.contents=''
path = 'http://%s:%s@%s:80/%s' % (self.userid,self.password,
self.hostname,url)
web_file = urllib.urlopen(path)
if web_file.getcode() != 200:
return None
self.contents = web_file.read()
return self.contents