Obtain Web Page Information : Web Page « Network « Python






Obtain Web Page Information

import sys, urllib2

req = urllib2.Request(sys.argv[1])
fd = urllib2.urlopen(req)
print "Retrieved", fd.geturl()
info = fd.info()
for key, value in info.items():
    print "%s = %s" % (key, value)
    

           
       








Related examples in the same category

1.Extract list of URLs in a web pageExtract list of URLs in a web page
2.Download from a websiteDownload from a website