failmap/admin

View on GitHub
websecmap/reporting/management/commands/rebuild_url_reports.py

Summary

Maintainability
B
4 hrs
Test Coverage
import logging

from websecmap.app.management.commands._private import GenericTaskCommand
from websecmap.reporting import rebuild_url_report

log = logging.getLogger(__name__)


class Command(GenericTaskCommand):
    """Remove all organization and url ratings, then rebuild them from scratch. Used whan ratings changed and impact
    history. Also creates stats for over a year."""

    help = __doc__

    def handle(self, *args, **options):

        try:
            self.scanner_module = rebuild_url_report
            return super().handle(self, *args, **options)
        except KeyboardInterrupt:
            log.info("Received keyboard interrupt. Stopped.")