timing a web response using urllib.urlopen??

Jeff Epler jepler at unpythonic.net
Wed Dec 31 12:09:56 EST 2003


import time

t0 = time.time()
do something
t1 = time.time()
print "elapsed time ", t1 - t0, "seconds"

In your case, "do something" would be along the lines of
    f = urllib.urlopen(URL)
    f.read()
to request the URL and read the whole response.

Jeff





More information about the Python-list mailing list