1.1.3 Response Objects

Response objects are derived from dict and map header names (lower case with the trailing colon removed) to header values. In addition to the dict methods a Response object also has:

fromcache
If true the the response was returned from the cache.

version
The version of HTTP that the server supports. A value of 11 means '1.1'.

status
The numerical HTTP status code returned in the response.

reason
The human readable component of the HTTP response status code.

previous
If redirects are followed then the Response object returned is just for the very last HTTP request and previous points to the previous Response object. In this manner they form a chain going back through the responses to the very first response. Will be None if there are no previous respones.

The Response object also populates the header content-location, that contains the URI that was ultimately requested. This is useful if redirects were encountered, you can determine the ultimate URI that the request was sent to. All Response objects contain this key value, including previous responses so you can determine the entire chain of redirects. If Http.force_exception_to_status_code is True and the number of redirects has exceeded the number of allowed number of redirects then the Response object will report the error in the status code, but the complete chain of previous responses will still be in tact.