Skip to content

Instantly share code, notes, and snippets.

@Superbil
Created March 30, 2013 07:41
Show Gist options
  • Save Superbil/5275766 to your computer and use it in GitHub Desktop.
Save Superbil/5275766 to your computer and use it in GitHub Desktop.
try to fetch http status
#!/bin/env python
import time
import httplib
def scanx_run(command, server):
scanx = httplib.HTTPConnection(server)
# debug mode
# scanx.set_debuglevel(1)
# run command
print "run:", server + command
scanx.request("GET", command)
result = scanx.getresponse()
# result status, debug on not ok (200)
if (result.status != httplib.OK):
print result.status, result.reason
print result.read()
def main():
start_time = time.time()
scanx_run( "/" , "tw.yahoo.com" )
print "now", time.time() - start_time
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment