import urllib mytest = urllib.urlopen('http://www.sec.gov') mytest.headers.items() ('content-length', '20833'), ('expires', 'Sun, 02 Feb 2014 19:36:12 GMT'), ('server', 'SEC'), ('connection', 'close'), ('cache-control', 'max-age=0'), ('date', 'Sun, 02 Feb 2014 19:36:12 GMT'), ('content-type', 'text/html')]
mytest.headers.items () is a list of tuples, in my example you can see that the last element in the list describes the contents
I'm not sure if the length varies, so you can iterate over it to find one that has a 'content-type' in it.
Pynewbie
source share