mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-24 17:44:33 +00:00
Update docs about local files support for "scrapy shell"
This commit is contained in:
parent
fb8ab2427b
commit
713e1eee9b
@ -373,7 +373,9 @@ shell
|
||||
* Requires project: *no*
|
||||
|
||||
Starts the Scrapy shell for the given URL (if given) or empty if no URL is
|
||||
given. See :ref:`topics-shell` for more info.
|
||||
given. Also supports UNIX-style local file paths, either relative with
|
||||
``./`` or ``../`` prefixes or absolute file paths.
|
||||
See :ref:`topics-shell` for more info.
|
||||
|
||||
Usage example::
|
||||
|
||||
|
@ -53,6 +53,36 @@ this::
|
||||
|
||||
Where the ``<url>`` is the URL you want to scrape.
|
||||
|
||||
:command:`shell` also works for local files. This can be handy if you want
|
||||
to play around with a local copy of a web page. :command:`shell` understands
|
||||
the following syntaxes for local files::
|
||||
|
||||
# UNIX-style
|
||||
scrapy shell ./path/to/file.html
|
||||
scrapy shell ../other/path/to/file.html
|
||||
scrapy shell /absolute/path/to/file.html
|
||||
|
||||
# File URI
|
||||
scrapy shell file:///absolute/path/to/file.html
|
||||
|
||||
.. warning:: :command:`shell` will interpret ``index.html`` as a domain name,
|
||||
not as a relative path to a local file, and will trigger a DNS lookup error::
|
||||
|
||||
$ scrapy shell index.html
|
||||
[ ... scrapy shell starts ... ]
|
||||
2016-01-26 10:29:51 [scrapy] DEBUG: Gave up retrying <GET http://index.html>
|
||||
(failed 3 times): DNS lookup failed:
|
||||
address 'index.html' not found: [Errno -5] No address associated with hostname.
|
||||
[ ... traceback ... ]
|
||||
twisted.internet.error.DNSLookupError: DNS lookup failed:
|
||||
address 'index.html' not found: [Errno -5] No address associated with hostname.
|
||||
|
||||
Use ``./`` prefix instead::
|
||||
|
||||
$ scrapy shell ./index.html
|
||||
[ ... scrapy shell starts ... ]
|
||||
|
||||
|
||||
Using the shell
|
||||
===============
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user