Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Docs for the Response.protocol attribute

Eugenio Lacuesta587b4dd71fca
diff --git a/docs/topics/request-response.rst b/docs/topics/request-response.rst
index f3aaa2c8f..d7d5cd44e 100644
--- a/docs/topics/request-response.rst
+++ b/docs/topics/request-response.rst
@@ -693,9 +693,22 @@ Response objects
:param ip_address: The IP address of the server from which the Response originated.
:type ip_address: :class:`ipaddress.IPv4Address` or :class:`ipaddress.IPv6Address`
+ :param protocol: A tuple containing information about the protocol that was used
+ to download the response. Taken from the ``version`` attribute of the
+ corresponding :class:`twisted.web.client.Response` object, it will tipically
+ consist of the protocol and version numbers, e.g. ``(b"HTTP", 1, 1)``
+ to represent "HTTP/1.1".
+ :type protocol: :class:`tuple`
+
+ .. versionadded:: 2.X.X
+ The ``protocol`` parameter.
+
.. versionadded:: 2.1.0
The ``ip_address`` parameter.
+ .. versionadded:: 2.0.0
+ The ``certificate`` parameter.
+
.. attribute:: Response.url
A string containing the URL of the response.
@@ -780,6 +793,8 @@ Response objects
.. attribute:: Response.certificate
+ .. versionadded:: 2.0.0
+
A :class:`twisted.internet.ssl.Certificate` object representing
the server's SSL certificate.
@@ -795,6 +810,20 @@ Response objects
handler, i.e. for ``http(s)`` responses. For other handlers,
:attr:`ip_address` is always ``None``.
+ .. attribute:: Response.protocol
+
+ .. versionadded:: 2.X.X
+
+ A tuple containing information about the protocol that was used
+ to download the response. Taken from the ``version`` attribute of the
+ corresponding :class:`twisted.web.client.Response` object, it will tipically
+ consist of the protocol and version numbers, e.g. ``(b"HTTP", 1, 1)``
+ to represent "HTTP/1.1".
+
+ This attribute is currently only populated by the HTTP 1.1 download
+ handler, i.e. for ``http(s)`` responses. For other handlers,
+ :attr:`protocol` is always ``None``.
+
.. method:: Response.copy()
Returns a new Response which is a copy of this Response.