From b279bc8546994f5610836e63490b4a7a262b3d77 Mon Sep 17 00:00:00 2001 From: Paul Tremberth Date: Thu, 19 Jan 2017 16:28:52 +0100 Subject: [PATCH 1/3] Fix view command against new --no-redirect option --- scrapy/commands/view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scrapy/commands/view.py b/scrapy/commands/view.py index 4eb44f77d..59592d08b 100644 --- a/scrapy/commands/view.py +++ b/scrapy/commands/view.py @@ -11,7 +11,7 @@ class Command(fetch.Command): "contents in a browser" def add_options(self, parser): - ScrapyCommand.add_options(self, parser) + super(Command, self).add_options(parser) parser.add_option("--spider", dest="spider", help="use this spider") From fc07711614549ce8f0464b3fca5b0f4acd746681 Mon Sep 17 00:00:00 2001 From: Paul Tremberth Date: Mon, 30 Jan 2017 15:54:28 +0100 Subject: [PATCH 2/3] Remove unused --headers option for view command --- scrapy/commands/view.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scrapy/commands/view.py b/scrapy/commands/view.py index 59592d08b..59e665016 100644 --- a/scrapy/commands/view.py +++ b/scrapy/commands/view.py @@ -12,8 +12,7 @@ class Command(fetch.Command): def add_options(self, parser): super(Command, self).add_options(parser) - parser.add_option("--spider", dest="spider", - help="use this spider") + parser.remove_option("--headers") def _print_response(self, response, opts): open_in_browser(response) From 4156a86148f07c108d3ea4248a2d4a7e2a58ffa9 Mon Sep 17 00:00:00 2001 From: Paul Tremberth Date: Mon, 30 Jan 2017 15:57:37 +0100 Subject: [PATCH 3/3] Update docs on view command --- docs/topics/commands.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/topics/commands.rst b/docs/topics/commands.rst index 6636c30cb..eaeeee113 100644 --- a/docs/topics/commands.rst +++ b/docs/topics/commands.rst @@ -358,6 +358,12 @@ Opens the given URL in a browser, as your Scrapy spider would "see" it. Sometimes spiders see pages differently from regular users, so this can be used to check what the spider "sees" and confirm it's what you expect. +Supported options: + +* ``--spider=SPIDER``: bypass spider autodetection and force use of specific spider + +* ``--no-redirect``: do not follow HTTP 3xx redirects (default is to follow them) + Usage example:: $ scrapy view http://www.example.com/some/page.html