import urllib2 def GetHtmlPy(url, encodechar): response = urllib2.urlopen(url) html = response.read().decode(encodechar) return html