request.add_header('Accept-encoding', 'gzip')
response = urllib.request.urlopen(request)
if response.info().get('Content-Encoding') == 'gzip':
    pass
Does python urllib2 automatically uncompress gzip data fetched from webpage?