added scrapy-ctl view command

This commit is contained in:
Pablo Hoffman 2010-05-26 10:29:32 -03:00
parent 2905a2083b
commit 2d3135603e
1 changed files with 20 additions and 0 deletions

20
scrapy/commands/view.py Normal file
View File

@ -0,0 +1,20 @@
from scrapy.command import ScrapyCommand
from scrapy.commands import fetch
from scrapy.utils.response import open_in_browser
class Command(fetch.Command):
def short_desc(self):
return "Open a URL in browser, as seen by Scrapy"
def long_desc(self):
return "Fetch a URL using the Scrapy downloader and show its " \
"contents in a browser"
def add_options(self, parser):
ScrapyCommand.add_options(self, parser)
parser.add_option("--spider", dest="spider",
help="use this spider")
def _print_response(self, response, opts):
open_in_browser(response)