mirror of https://github.com/scrapy/scrapy.git
stats: limit the default number of stats history to 10
--HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40522
This commit is contained in:
parent
7414e93102
commit
570f49d407
|
|
@ -12,11 +12,13 @@ class Command(ScrapyCommand):
|
|||
def add_options(self, parser):
|
||||
ScrapyCommand.add_options(self, parser)
|
||||
parser.add_option("-p", "--path", dest="path", help="restrict stats to PATH", metavar="PATH")
|
||||
parser.add_option("--limit", dest="limit", default='10', help="limit the number of stats")
|
||||
|
||||
def run(self, args, opts):
|
||||
if not args:
|
||||
print "A domain is required"
|
||||
return
|
||||
|
||||
if not settings['SCRAPING_DB']:
|
||||
print "SCRAPING_DB setting is required for this command"
|
||||
return
|
||||
|
|
@ -26,5 +28,5 @@ class Command(ScrapyCommand):
|
|||
|
||||
for domain in args:
|
||||
print "# %s" % domain
|
||||
pprint.pprint(list(ddh.getall(domain, opts.path)))
|
||||
pprint.pprint(list(ddh.get(domain, path=opts.path, count=int(opts.limit))))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue