Created
April 19, 2015 14:05
-
-
Save kt3k/78c5bdde1766c4b8bf1d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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