class _Response(proxyForInterface(IResponse)): (source)
A wrapper for :class:`twisted.web.iweb.IResponse` which manages cookies and adds a few convenience methods.
Method | __init__ |
Undocumented |
Method | __repr__ |
Generate a representation of the response which includes the HTTP status code, Content-Type header, and body size, if available. |
Method | collect |
Incrementally collect the body of the response, per :func:`treq.collect()`. |
Method | content |
Read the entire body all at once, per :func:`treq.content()`. |
Method | cookies |
Get a copy of this response's cookies. |
Method | history |
Get a list of all responses that (such as intermediate redirects), that ultimately ended in the current response. The responses are ordered chronologically. |
Method | json |
Collect the response body as JSON per :func:`treq.json_content()`. |
Method | text |
Read the entire body all at once as text, per :func:`treq.text_content()`. |
Instance Variable | original |
Undocumented |
Instance Variable | _cookiejar |
Undocumented |
Generate a representation of the response which includes the HTTP status code, Content-Type header, and body size, if available.
Incrementally collect the body of the response, per :func:`treq.collect()`. :param collector: A single argument callable that will be called with chunks of body data as it is received. :returns: A `Deferred` that fires when the entire body has been received.
Read the entire body all at once, per :func:`treq.content()`. :returns: A `Deferred` that fires with a `bytes` object when the entire body has been received.
Get a list of all responses that (such as intermediate redirects), that ultimately ended in the current response. The responses are ordered chronologically. :returns: A `list` of :class:`~treq.response._Response` objects
Collect the response body as JSON per :func:`treq.json_content()`. :param kwargs: Any keyword arguments accepted by :py:func:`json.loads` :rtype: Deferred that fires with the decoded JSON when the entire body has been read.