rhino.response
class Response
Represents an HTTP response.
Class attributes:
__init__(code, headers=None, body='')
Create a new HTTP response.
Parameters:
a value for the response body. The body is only validated when the request is finalized (in __call__
).
Valid values for the response body are:
add_callback(fn)
Add a callback to be executed when the response is closed.
body
The response body.
code
The HTTP status code as an integer.
conditional_to(request)
Return a response that is conditional to a given request.
Returns the Response instance unchanged, or a new Response instance with a "304 Not Modified" status code.
headers
A wsgiref.headers.Headers
instance.
status
The status line as a string (status code + reason)
class Entity
Represents a response body with entity headers.
__init__(body, **kw)
response(code, body='', etag=None, last_modified=None, expires=None, **kw)
Helper to build an HTTP response.
Parameters:
Response.__init__
for details.
body
as argument and should return a string (quotes will be added to the returned string as described above).
x_powered_by
=> X-Powered-By
).
ok(body='', code=200, **kw)
Shortcut for response(200, ...).
The status code must be in the 2xx range.
created(body='', **kw)
Shortcut for response(201, ...).
no_content(**kw)
Shortcut for response(204, body='', ...).
redirect(location, code=302, **kw)
Shortcut for response(302, location=location, ...)
The status code must be in the 3xx range.