import urllib.request
import gzip
response = urllib.request.urlopen('
https://www.python.org/')
if response.info().get('Content-Encoding') == 'gzip':
data = gzip.decompress(response.read())
print(data.decode('utf-8'))
else:
print(response.read().decode('utf-8')