rendered paste body#!/usr/bin/env pythonimport httplibimport urllibfrom urlparse import urlparse# Set infile, outfileinPath = "urls.txt"outPath = "headers.csv"# Open the infile and processinfile = open(inPath, 'rU')if infile: outfile = open(outPath, 'w') outfile.write("URL,HEADER,MESSAGE\n") for line in infile: parsed_url = urlparse(line) grab = httplib.HTTP(parsed_url[1]) grab.putrequest('GET', parsed_url[2]) grab.endheaders() errcode, errmsg, header = grab.getreply() domain = parsed_url[1] path = parsed_url[2] url = domain + path print "URL: %s" % url outfile.write("%s,%s,%s\n" % (url, errcode, errmsg)) # Close the files infile.close() outfile.close()else: print "Error opening the infile"