1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-24 19:44:33 +00:00

document shortcuts in TextResponse class

This commit is contained in:
Daniel Graña 2014-04-24 00:11:42 -03:00
parent d37308ad77
commit b4593c2ae7

View File

@ -526,6 +526,11 @@ TextResponse objects
4. the encoding inferred by looking at the response body. This is the more
fragile method but also the last one tried.
.. attribute:: TextResponse.selector
A :class:`~scrapy.selector.Selector` instance using the response as
target. The selector is lazily instantiated on first access.
:class:`TextResponse` objects support the following methods in addition to
the standard :class:`Response` ones:
@ -543,6 +548,19 @@ TextResponse objects
(typically `ascii`) to convert the body to unicode, instead of the response
encoding.
.. method:: TextResponse.xpath(query)
A shortcut to ``TextResponse.selector.xpath(query)``::
response.xpath('//p')
.. method:: TextResponse.css(query)
A shortcut to ``TextResponse.selector.css(query)``::
response.css('p')
HtmlResponse objects
--------------------