Skip to content

Instantly share code, notes, and snippets.

@kt3k
Created April 19, 2015 14:05
Show Gist options
  • Save kt3k/78c5bdde1766c4b8bf1d to your computer and use it in GitHub Desktop.
Save kt3k/78c5bdde1766c4b8bf1d to your computer and use it in GitHub Desktop.
#! /usr/bin/env python
import time
import urllib2
import sys
def usage():
print """usage: python reponse_time.py [url]"""
def main():
if len(sys.argv) != 2:
usage()
sys.exit()
url = sys.argv[1]
start = time.time()
urllib2.urlopen(url)
end = time.time()
response_time = end - start
print time.strftime('[%Y/%m/%d %H:%M:%S]'), response_time
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment