import http.client
conn = http.client.HTTPConnection('www.python.org')
conn.request('GET', '/index.html')
r1 = conn.getresponse()
dict = r1.getheaders()
print(dict)
Convert http headers (string) to a python dictionary