Package cherrypy :: Module _cprequest :: Class Response
[hide private]
[frames] | no frames]

Class Response

source code

object --+
         |
        Response

An HTTP Response, including status, headers, and body.

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
collapse_body(self)
Collapse self.body to a single string; replace it and return it.
source code
 
finalize(self)
Transform headers (and cookies) into self.header_list.
source code
 
check_timeout(self)
If now > self.time + self.timeout, set self.timed_out.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  status = ''
The HTTP Status-Code and Reason-Phrase.
  header_list = []
A list of the HTTP response headers as (name, value) tuples.
  headers = {}
A dict-like object containing the response headers.
  cookie = <SimpleCookie: >
See help(Cookie).
  body = <cherrypy._cprequest.ResponseBody object>
The body (entity) of the HTTP response.
  time = None
The value of time.time() when created.
  timeout = 300
Seconds after which the response will be aborted.
  timed_out = False
Flag to indicate the response should be aborted, because it has exceeded its timeout.
  stream = False
If False, buffer the response body.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

finalize(self)

source code 

Transform headers (and cookies) into self.header_list. (Core)

check_timeout(self)

source code 

If now > self.time + self.timeout, set self.timed_out.

This purposefully sets a flag, rather than raising an error, so that a monitor thread can interrupt the Response thread.


Class Variable Details [hide private]

header_list

A list of the HTTP response headers as (name, value) tuples. In general, you should use response.headers (a dict) instead. This attribute is generated from response.headers and is not valid until after the finalize phase.

Value:
[]

headers

A dict-like object containing the response headers. Keys are header names (in Title-Case format); however, you may get and set them in a case-insensitive manner. That is, headers['Content-Type'] and headers['content-type'] refer to the same value. Values are header values (decoded according to :rfc:`2047` if necessary).

.. seealso:: classes :class:`HeaderMap`, :class:`HeaderElement`

Value:
{}

time

The value of time.time() when created. Use in HTTP dates.

Value:
None