Hi Sergey,

Several points:

1. Making a new factory for each *client* connection isn't unusual -- just
for servers.
2. The API you probably want to use is twisted.web.client.Agent.
3. You could do something like this (I wrote no tests for this!)

def timeURL(agent, url):
    return agent.get(url).addCallback(_responseReceived, time.time(), url)

def _responseReceived(response, startTime, url):
    elapsed = time.time() - startTime
    print "Elapsed for {}: {}s".format(url, elapsed)
    # Note: response received gets called before the entire body is received

... or you could wrap that startTime and URL state in an object, of course
:-)

hope to help
lvh
_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Reply via email to