res = urllib.request.urlopen('http://www.iana.org/assignments/language-subtag-registry'
    )
http_message = res.info()
full = http_message.type
main = http_message.maintype
Python: How to get the Content-Type of an URL?