I downloaded a webpage in my python script. In most cases, this works fine.
However, this one had a response header: GZIP encoding, and when I tried to print the sou
I use something like that:
f = urllib2.urlopen(request) data = f.read() try: from cStringIO import StringIO from gzip import GzipFile data2 = GzipFile('', 'r', 0, StringIO(data)).read() data = data2 except: #print "decompress error %s" % err pass return data