Python to measure HTTP and HTTPS performances: best way ???

vincent delft vincent_delft at yahoo.com
Fri Nov 12 05:40:13 EST 2004


I want to write a script that will monitore the performance of a web
application delivering HTTP and HTTPS pages.

I would like to know the best way to do it...

By reading Python Doc. I've found the following:
For HTTP:
def http_monitor(host,url):
	starttts=time.time()
	conn=httplib.HTTPConnection(host)
	conn.request("get","/%s" % url)
	res=conn.getresponse()
	data=res.read()
        return time.time()-starttts  
Where Host and URL concerns an HTTP web page.

For HTTPS:
def https_monitor(host,url):
	starttts=time.time()
	conn=httplib.HTTPSConnection(host)
	conn.request("get","/%s" % url)
	res=conn.getresponse()
	data=res.read()
        return time.time()-starttts  
Where Host and URL concerns an HTTPS web page.

Does this is valid ?
For HTTPS, I'm not dealing with encryption Key ... is it normal ?

Thanks.



More information about the Python-list mailing list