4. Response

4.1. Synopsis

>>> form http import Response
>>> r = Response(200)
>>> print r.status
200

4.2. Interface

Response instances have the following methods:

class http.response.Response([defaults])

The Response object encapsulates HTTP style responses.

base

Returns the base URI for this response

Return type:class:Url or None
content

Returns the actual content of the response

Return type:string
content_is_text

Returns True if the “Content-Type” header is set to text

Return type:boolean
content_is_xhtml

Returns True if the “Content-Type” header is set to XHTML

Return type:boolean
content_is_xml

Returns True if the “Content-Type” header is set to XML

Return type:boolean
content_length

Returns the content-length of the actual response

Return type:int
date

Returns a datetime object represeting the Date header

Return type:class:datetime
expires

Returns a datetime object represeting the Expires header

Return type:class:datetime
header(name)

Returns the value for a given header

Return type:string
headers

Returns the class:Headers object

Return type:class:Headers
is_client_error

Returns if the response was a client error

Return type:boolean
is_error

Returns if the response was an error

Return type:boolean
is_info

Returns if the response was informational

Return type:boolean
is_redirect

Returns if the response was redirect

Return type:boolean
is_server_error

Returns if the response was a client server

Return type:boolean
is_success

Returns if the response was success

Rtypen:boolean
last_modified

Returns a datetime object represeting the Last-Modified header

Return type:class:datetime
request

Returns the request object that caused that response

Return type:class:Request
status

Returns the HTTP status

Return type:int
status_line

Returns the string ‘<code> <message>’

Return type:string