Skip to content

Commit f9208db

Browse files
committed
Merge pull request scrapy#1154 from dianakhuang/patch-2
Remove references to the `sel` object in shell.rst
2 parents 6f000b8 + 91a60d9 commit f9208db

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

docs/topics/shell.rst

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ Those objects are:
8585
* ``response`` - a :class:`~scrapy.http.Response` object containing the last
8686
fetched page
8787

88-
* ``sel`` - a :class:`~scrapy.selector.Selector` object constructed
89-
with the last response fetched
90-
9188
* ``settings`` - the current :ref:`Scrapy settings <topics-settings>`
9289

9390
Example of shell session
@@ -117,7 +114,6 @@ all start with the ``[s]`` prefix)::
117114
[s] item {}
118115
[s] request <GET http://scrapy.org>
119116
[s] response <200 http://scrapy.org>
120-
[s] sel <Selector xpath=None data=u'<html>\n <head>\n <meta charset="utf-8'>
121117
[s] settings <scrapy.settings.Settings object at 0x2bfd650>
122118
[s] spider <Spider 'default' at 0x20c6f50>
123119
[s] Useful shortcuts:
@@ -129,24 +125,23 @@ all start with the ``[s]`` prefix)::
129125

130126
After that, we can start playing with the objects::
131127

132-
>>> sel.xpath("//h2/text()").extract()[0]
133-
u'Welcome to Scrapy'
128+
>>> response.xpath("//h1/text()").extract()[0]
129+
u'Meet Scrapy'
134130

135131
>>> fetch("http://slashdot.org")
136132
[s] Available Scrapy objects:
137133
[s] crawler <scrapy.crawler.Crawler object at 0x1a13b50>
138134
[s] item {}
139135
[s] request <GET http://slashdot.org>
140136
[s] response <200 http://slashdot.org>
141-
[s] sel <Selector xpath=None data=u'<html lang="en">\n<head>\n\n\n\n\n<script id="'>
142137
[s] settings <scrapy.settings.Settings object at 0x2bfd650>
143138
[s] spider <Spider 'default' at 0x20c6f50>
144139
[s] Useful shortcuts:
145140
[s] shelp() Shell help (print this help)
146141
[s] fetch(req_or_url) Fetch request (or URL) and update local objects
147142
[s] view(response) View response in a browser
148143

149-
>>> sel.xpath('//title/text()').extract()
144+
>>> response.xpath('//title/text()').extract()
150145
[u'Slashdot: News for nerds, stuff that matters']
151146

152147
>>> request = request.replace(method="POST")
@@ -203,7 +198,7 @@ When you run the spider, you will get something similar to this::
203198

204199
Then, you can check if the extraction code is working::
205200

206-
>>> sel.xpath('//h1[@class="fn"]')
201+
>>> response.xpath('//h1[@class="fn"]')
207202
[]
208203

209204
Nope, it doesn't. So you can open the response in your web browser and see if

0 commit comments

Comments
 (0)