title: python urllib2 timing
body: <p>I'd like to collect statistics related to how long each phase of a web request takes. <code>httplib</code> offers:</p>
  
  <blockquote>
  <pre><code>def run(self):
      conn = httplib.HTTPConnection('www.example.com')
      start = time.time()
      conn.request('GET', '/')
      request_time = time.time()
      resp = conn.getresponse()
      response_time = time.time()
      conn.close()
      transfer_time = time.time()
  
      self.custom_timers['request sent'] = request_time - start
      self.custom_timers['response received'] = response_time - start
      self.custom_timers['content transferred'] = transfer_time - start
  
      assert (resp.status == 200), 'Bad Response: HTTP %s' % resp.status
  </code></pre>
  </blockquote>
  
  <p>Are these statistics available from a more high-level interface like <code>urllib2</code>? Is there high level library offering such statistics?</p>