Merge pull request #2503 from redapple/view-no-redirect

[MRG] Fix view command against new --no-redirect option
This commit is contained in:
Mikhail Korobov 2017-02-02 21:24:56 +05:00 committed by GitHub
commit c305c46254
2 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -11,9 +11,8 @@ class Command(fetch.Command):
"contents in a browser"
def add_options(self, parser):
ScrapyCommand.add_options(self, parser)
parser.add_option("--spider", dest="spider",
help="use this spider")
super(Command, self).add_options(parser)
parser.remove_option("--headers")
def _print_response(self, response, opts):
open_in_browser(response)