time.time is not the most reliable and accurate. You can use the timeIt module in python for your profiling purpose. http://docs.python.org/library/timeit.html Here is a snippet of code that uses timeit
statmnt = 'print "Replace print with the snippet you want to profile"' setup = 'print "Replace this line with some snippet specific imports"' n = 1
In your case, you need to create three timeit objects for the request, response, and content. Additional information about the timeit module
see the documentation.
Himanshu jindal
source share