|
Python command line program for printing HTTP headers |
|
|
|
|
Wednesday, 25 October 2006 |
#Usage: #httpheaders.py # #Example: #httpheaders.py www.softabar.com /software/sclec/ # import sys,httplib
def main(): connection = httplib.HTTPConnection(sys.argv[1]) connection.request("GET", sys.argv[2]) response=connection.getresponse() headers=response.getheaders() if response.version == "11": version="HTTP/1.1" else: version="HTTP/1.0" print version,response.status,response.reason for header,value in headers: print header.capitalize(),':',value print connection.close()
if __name__ == "__main__": main()
|
|
Last Updated ( Friday, 01 February 2008 )
|