title: How do I access response headers on an error using urlib2?
body: <p>I'm using the Harvest API (http://www.getharvest.com/api).  When a client goes over it's quota, a 503 response is returned.  In that response there should be a header called "Retry-After" that tells me how long to wait before trying again.</p>
  
  <p>How do I access the response headers when the call fails?  I'm grabbing the HTTPError exception, but can't figure out how to get the headers out of it.</p>
  
  <p>I can get the response body with exception.read(), but that's just the body without headers.</p>
  
  <p>Some relevant code:</p>
  
  <pre><code>try:
      request = urllib2.Request( url=self.uri+url, headers=self.headers )
      r = urllib2.urlopen(request)
      xml = r.read()
      return parseString( xml )
  except urllib2.HTTPError as err:
      logger.debug("EXCEPTION: %s" % err.read() )
  </code></pre>