(self)
return result_dict
Returns a dict with the analyzer results.
Returns a dict with the analyzer results.
Returns a dict with the analyzer results .
def _fetch_data(self):
        """Returns a dict with the analyzer results."""
        response = self.api.session.get(self.resource_uri)
        if not error.check_return_status(response, logger):
            return {}

        data = error.get_response_json(response, logger)

        objects = data.get('objects')
        if not objects:
            return {}

        result_dict = {}
        for result in objects[0]:
            result_id = result.get('analysissession_id')
            if result_id != self._session_id:
                continue
            status_list = result.get('status', [])
            if len(status_list) != 1:
                continue
            status = status_list[0]

            timeline = result.get('timeline', {})

            result_dict['id'] = result_id
            result_dict.setdefault('analyzers', [])
            result_dict['analyzers'].append({
                'name': result.get('analyzer_name', 'N/A'),
                'results': result.get('result'),
                'description': result.get('description', 'N/A'),
                'user': result.get('user', {}).get('username', 'System'),
                'parameters': json.loads(result.get('parameters', '{}')),
                'status': status.get('status', 'Unknown'),
                'status_date': status.get('updated_at', ''),
                'log': result.get('log', ''),
                'created': result.get('created_at'),
                'timeline': timeline.get('name', 'N/A'),
                'timeline_id': timeline.get('id', -1),
                'timeline_user': timeline.get('user', {}).get(
                    'username', 'System'),
                'timeline_name': timeline.get('name', 'N/A'),
                'timeline_deleted': timeline.get('deleted', False),
            })

        return result_dict
def _fetch_data ( self ) : response = self . api . session . get ( self . resource_uri ) if not error . check_return_status ( response , logger ) : return { } data = error . get_response_json ( response , logger ) objects = data . get ( 'objects' ) if not objects : return { } result_dict = { } for result in objects [ 0 ] : result_id = result . get ( 'analysissession_id' ) if result_id != self . _session_id : continue status_list = result . get ( 'status' , [ ] ) if len ( status_list ) != 1 : continue status = status_list [ 0 ] timeline = result . get ( 'timeline' , { } ) result_dict [ 'id' ] = result_id result_dict . setdefault ( 'analyzers' , [ ] ) result_dict [ 'analyzers' ] . append ( { 'name' : result . get ( 'analyzer_name' , 'N/A' ) , 'results' : result . get ( 'result' ) , 'description' : result . get ( 'description' , 'N/A' ) , 'user' : result . get ( 'user' , { } ) . get ( 'username' , 'System' ) , 'parameters' : json . loads ( result . get ( 'parameters' , '{}' ) ) , 'status' : status . get ( 'status' , 'Unknown' ) , 'status_date' : status . get ( 'updated_at' , '' ) , 'log' : result . get ( 'log' , '' ) , 'created' : result . get ( 'created_at' ) , 'timeline' : timeline . get ( 'name' , 'N/A' ) , 'timeline_id' : timeline . get ( 'id' , - 1 ) , 'timeline_user' : timeline . get ( 'user' , { } ) . get ( 'username' , 'System' ) , 'timeline_name' : timeline . get ( 'name' , 'N/A' ) , 'timeline_deleted' : timeline . get ( 'deleted' , False ) , } ) return result_dict