logentries_api/special_alerts.py
def _create_scheduled_query(self, query, change, scope_unit, scope_count):
        """
        Create the scheduled query
        """
        query_data = {
            'scheduled_query': {
                'name': 'ForAnomalyReport',
                'query': query,
                'threshold_type': '%',
                'threshold_value': change,
                'time_period': scope_unit.title(),
                'time_value': scope_count,
            }
        }

        query_url = 'https://logentries.com/rest/{account_id}/api/scheduled_queries'

        return self._api_post(
            url=query_url.format(account_id=self.account_id),
            data=json.dumps(query_data, sort_keys=True)
        )
def _create_scheduled_query(self, query, change, scope_unit, scope_count):
        query_data = {
            'scheduled_query': {
                'name': 'ForAnomalyReport',
                'query': query,
                'threshold_type': '%',
                'threshold_value': change,
                'time_period': scope_unit.title(),
                'time_value': scope_count,
            }
        }

        query_url = 'https://logentries.com/rest/{account_id}/api/scheduled_queries'

        return self._api_post(
            url=query_url.format(account_id=self.account_id),
            data=json.dumps(query_data, sort_keys=True)
        )
def _create_scheduled_query ( self , query , change , scope_unit , scope_count ) : query_data = { 'scheduled_query' : { 'name' : 'ForAnomalyReport' , 'query' : query , 'threshold_type' : '%' , 'threshold_value' : change , 'time_period' : scope_unit . title ( ) , 'time_value' : scope_count , } } query_url = 'https://logentries.com/rest/{account_id}/api/scheduled_queries' return self . _api_post ( url = query_url . format ( account_id = self . account_id ) , data = json . dumps ( query_data , sort_keys = True ) )
Create the scheduled query
Create the scheduled query