I have a list of domains and I need to get some stat for example average response time for the index page of each site about them.
I wanna to get the Time To First Byte for each domain. I searched a little but I did not find any complete answer to my question. Here is my funtion for calculating the response time of a host:
opener = urllib2.build_opener()
request = urllib2.Request("http://"+host)
start = time.time()
resp = opener.open(request)
# read one byte
resp.read(1)
ttfb = time.time() - start
# read the rest
resp.read()
ttlb = time.time() - start
print "The TTFirst Byte of " +host+"is:"+ttlb
When I run it for google.com for example, I got this error:
google.com not found