From 633abfbea1bda68918618900c25d1489cc824c68 Mon Sep 17 00:00:00 2001 From: Thom Dixon Date: Wed, 24 Aug 2016 08:47:52 -0700 Subject: [PATCH 1/2] Correct documentation about Response parameters This fixes issue #2196 --- docs/topics/request-response.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/topics/request-response.rst b/docs/topics/request-response.rst index c54685d9e..dccea32ba 100644 --- a/docs/topics/request-response.rst +++ b/docs/topics/request-response.rst @@ -463,7 +463,7 @@ method for this job. Here's an example spider which uses it:: Response objects ================ -.. class:: Response(url, [status=200, headers, body, flags]) +.. class:: Response(url, [status=200, headers=None, body=b'', flags=None, request=None]) A :class:`Response` object represents an HTTP response, which is usually downloaded (by the Downloader) and fed to the Spiders for processing. @@ -471,28 +471,28 @@ Response objects :param url: the URL of this response :type url: string - :param headers: the headers of this response. The dict values can be strings - (for single valued headers) or lists (for multi-valued headers). - :type headers: dict - :param status: the HTTP status of the response. Defaults to ``200``. :type status: integer + :param headers: the headers of this response. The dict values can be strings + (for single valued headers) or lists (for multi-valued headers). + :type headers: dict + :param body: the response body. It must be str, not unicode, unless you're using a encoding-aware :ref:`Response subclass `, such as :class:`TextResponse`. :type body: str - :param meta: the initial values for the :attr:`Response.meta` attribute. If - given, the dict will be shallow copied. - :type meta: dict - :param flags: is a list containing the initial values for the :attr:`Response.flags` attribute. If given, the list will be shallow copied. :type flags: list + :param request: the initial value of the :attr:`Response.request` attribute. + This represents the :class:`Request` that generated this response. + :type request: :class:`Request` object + .. attribute:: Response.url A string containing the URL of the response. From f68dc3026daf14c9ac1c303a90c0175eec92b73f Mon Sep 17 00:00:00 2001 From: Thom Dixon Date: Wed, 24 Aug 2016 09:11:27 -0700 Subject: [PATCH 2/2] Fix indentation --- docs/topics/request-response.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/topics/request-response.rst b/docs/topics/request-response.rst index dccea32ba..75b98d3b3 100644 --- a/docs/topics/request-response.rst +++ b/docs/topics/request-response.rst @@ -475,7 +475,7 @@ Response objects :type status: integer :param headers: the headers of this response. The dict values can be strings - (for single valued headers) or lists (for multi-valued headers). + (for single valued headers) or lists (for multi-valued headers). :type headers: dict :param body: the response body. It must be str, not unicode, unless you're