Я следую документации Spidermon по мониторингу Spiders, в их примерах мониторы, которые они создают, похоже, работают на всех своих Spiders, я не могу понять, как запустить монитор на одном Spider.
Я пытался передать моего Паука в test_min_items, но я не знаю, где это установить.
from spidermon import Monitor, MonitorSuite, monitors
@monitors.name('Item count')
class ItemCountMonitor(Monitor):
@monitors.name('Minimum number of items')
def test_min_items(self):
item_extracted = getattr(
self.data.stats, 'item_scraped_count', 0)
minimum_threshold = 10
msg = 'Extracted less than {} items'.format(
minimum_threshold)
self.assertTrue(
item_extracted > minimum_threshold, msg=msg
)
class SpiderCloseMonitorSuite(MonitorSuite):
monitors = [
ItemCountMonitor
]