From ebc8e79cf3bdd42a99e91d6e679248d07097d3db Mon Sep 17 00:00:00 2001 From: Michael Kelly Date: Mon, 14 Apr 2014 11:58:59 -0400 Subject: Fixed #18523 -- Added stream-like API to HttpResponse. Added getvalue() to HttpResponse to return the content of the response, along with a few other methods to partially match io.IOBase. Thanks Claude Paroz for the suggestion and Nick Sanford for review. --- docs/ref/request-response.txt | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'docs/ref') diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index 2a43756889..a86f416620 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -651,6 +651,12 @@ Attributes This attribute exists so middleware can treat streaming responses differently from regular responses. +.. attribute:: HttpResponse.closed + + .. versionadded:: 1.8 + + ``True`` if the response has been closed. + Methods ------- @@ -769,6 +775,27 @@ Methods This method makes an :class:`HttpResponse` instance a file-like object. +.. method:: HttpResponse.getvalue() + + .. versionadded:: 1.8 + + Returns the value of :attr:`HttpResponse.content`. This method makes + an :class:`HttpResponse` instance a stream-like object. + +.. method:: HttpResponse.writable() + + .. versionadded:: 1.8 + + Always ``True``. This method makes an :class:`HttpResponse` instance a + stream-like object. + +.. method:: HttpResponse.writelines(lines) + + .. versionadded:: 1.8 + + Writes a list of lines to the response. Line seperators are not added. This + method makes an :class:`HttpResponse` instance a stream-like object. + .. _HTTP status code: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10 .. _ref-httpresponse-subclasses: -- cgit v1.3