== Content of this script: == #! /usr/bin/env python import datetime from google.appengine.api import urlfetch print 'Content-Type: text/plain' print '' num_fetch=100 url = "http://google.com" totallen=0 starttime=datetime.datetime.now() for i in range(num_fetch): result = urlfetch.fetch(url) if result.status_code != 200: print "Failed #%d" % i else: totallen=totallen+len(result.content) endtime=datetime.datetime.now() dur=endtime-starttime seconds=dur.seconds+dur.microseconds*1e-6 num_fetch1=2 url1 = "http://amazon.com" totallen1=0 starttime=datetime.datetime.now() for i in range(num_fetch1): result = urlfetch.fetch(url1) if result.status_code != 200: print "Failed #%d" % i else: totallen1=totallen1+len(result.content) endtime=datetime.datetime.now() dur1=endtime-starttime seconds1=dur.seconds+dur.microseconds*1e-6 print '== Content of this script: ==' print '' f=open("fetchurl.py") g=f.readlines() for i in g: print i, print '' print '== Results: ==' print '' print '# of times %s was fetched : %d' % (url, num_fetch) print 'Time duration: ', dur print 'Speed (kBps): ', totallen/seconds/1000.0 print '' print '# of times %s was fetched : %d' % (url1, num_fetch1) print 'Time duration: ', dur1 print 'Speed (kBps): ', totallen1/seconds1/1000.0 == Results: == # of times http://google.com was fetched : 100 Time duration: 0:00:05.480065 Speed (kBps): 106.848002715 # of times http://amazon.com was fetched : 2 Time duration: 0:00:02.282589 Speed (kBps): 70.1641312649