class PostRecentView(viewsets.ViewSet): def retrieve(self, request, pk=None): self.widgets = Widgets(timespan='recent', level='post', pk=pk) return Response({ 'recent': self.widgets.get_intrusion_report(), 'vulnerable': self.widgets.get_vulnerable_morcha(), 'hour': self.widgets.get_hypersensitive_hour() })
class PostWeekView(viewsets.ViewSet): def retrieve(self, request, pk=None, date=None): self.widgets = Widgets(date=date, timespan='week', level='post', pk=pk) return Response({ 'count': self.widgets.total_count(), 'longest': self.widgets.longest_intrusion(), 'vulnerable': self.widgets.get_vulnerable_morcha(), 'report': self.widgets.get_intrusion_report() })
class PostRecentView(viewsets.ViewSet): def retrieve(self, request, pk=None): self.widgets = Widgets(timespan='recent', level='post', pk=pk) error, message = self.widgets.check_object_exists() if error: return Response(message, status=status.HTTP_400_BAD_REQUEST) else: return Response({ 'recent': self.widgets.get_intrusion_report(), 'vulnerable': self.widgets.get_vulnerable_morcha(), 'hour': self.widgets.get_hypersensitive_hour() })
class PostWeekView(viewsets.ViewSet): def retrieve(self, request, pk=None, date=None): self.widgets = Widgets(date=date, timespan='week', level='post', pk=pk) error, message = self.widgets.check_object_exists() if error: return Response(message, status=status.HTTP_400_BAD_REQUEST) else: return Response({ 'count': self.widgets.total_count(), 'longest': self.widgets.longest_intrusion(), 'vulnerable': self.widgets.get_vulnerable_morcha(), 'report': self.widgets.get_intrusion_report() })