lookyloo/lookyloo.py
def enqueue_capture(self, query: MutableMapping[str, Any], source: str, user: str, authenticated: bool) -> str:
        '''Enqueue a query in the capture queue (used by the UI and the API for asynchronous processing)'''
        perma_uuid = str(uuid4())
        p = self.redis.pipeline()
        for key, value in query.items():
            if isinstance(value, bool):
                # Yes, empty string because that's False.
                query[key] = 1 if value else ''
            if isinstance(value, list):
                query[key] = json.dumps(value)
        p.hmset(perma_uuid, query)  # type: ignore
        priority = self._get_priority(source, user, authenticated)
        p.zadd('to_capture', {perma_uuid: priority})
        p.zincrby('queues', 1, f'{source}|{authenticated}|{user}')
        p.set(f'{perma_uuid}_mgmt', f'{source}|{authenticated}|{user}')
        p.execute()
        return perma_uuid
Enqueue a query in the capture queue (used by the UI and the API for asynchronous processing)
Enqueue a query in the capture queue (used by the UI and the API for asynchronous processing)
Enqueue a query in the capture queue ( used by the UI and the API for asynchronous processing )
def enqueue_capture(self, query: MutableMapping[str, Any], source: str, user: str, authenticated: bool) -> str:
        perma_uuid = str(uuid4())
        p = self.redis.pipeline()
        for key, value in query.items():
            if isinstance(value, bool):
                query[key] = 1 if value else ''
            if isinstance(value, list):
                query[key] = json.dumps(value)
        p.hmset(perma_uuid, query)  
        priority = self._get_priority(source, user, authenticated)
        p.zadd('to_capture', {perma_uuid: priority})
        p.zincrby('queues', 1, f'{source}|{authenticated}|{user}')
        p.set(f'{perma_uuid}_mgmt', f'{source}|{authenticated}|{user}')
        p.execute()
        return perma_uuid
def enqueue_capture ( self , query : MutableMapping [ str , Any ] , source : str , user : str , authenticated : bool ) -> str : perma_uuid = str ( uuid4 ( ) ) p = self . redis . pipeline ( ) for key , value in query . items ( ) : if isinstance ( value , bool ) : query [ key ] = 1 if value else '' if isinstance ( value , list ) : query [ key ] = json . dumps ( value ) p . hmset ( perma_uuid , query ) priority = self . _get_priority ( source , user , authenticated ) p . zadd ( 'to_capture' , { perma_uuid : priority } ) p . zincrby ( 'queues' , 1 , f'{source}|{authenticated}|{user}' ) p . set ( f'{perma_uuid}_mgmt' , f'{source}|{authenticated}|{user}' ) p . execute ( ) return perma_uuid
Enqueue a query in the capture queue (used by the UI and the API for asynchronous processing)
Enqueue a query in the capture queue ( used by the UI and the API for asynchronous processing )
'''Enqueue a query in the capture queue (used by the UI and the API for asynchronous processing)''' # Yes, empty string because that's False. # type: ignore
self
query
MutableMapping[str, Any]
source
str
user
str
authenticated
bool