lookyloo/lookyloo.py
def _get_raw(self, capture_uuid: str, /, extension: str='*', all_files: bool=True) -> BytesIO:
        '''Get file(s) from the capture directory'''
        try:
            capture_dir = self._get_capture_dir(capture_uuid)
        except MissingUUID:
            return BytesIO(f'Capture {capture_uuid} not unavailable, try again later.'.encode())
        except NoValidHarFile:
            return BytesIO(f'No capture {capture_uuid} on the system.'.encode())
        all_paths = sorted(list(capture_dir.glob(f'*.{extension}')))
        if not all_files:
            # Only get the first one in the list
            with open(all_paths[0], 'rb') as f:
                return BytesIO(f.read())
        to_return = BytesIO()
        with ZipFile(to_return, 'w') as myzip:
            for path in all_paths:
                if path.name.endswith('pickle'):
                    continue
                myzip.write(path, arcname=f'{capture_dir.name}/{path.name}')
        to_return.seek(0)
        return to_return
Get file(s) from the capture directory
Get file(s) from the capture directory
Get file ( s ) from the capture directory
def _get_raw(self, capture_uuid: str, /, extension: str='*', all_files: bool=True) -> BytesIO:
        try:
            capture_dir = self._get_capture_dir(capture_uuid)
        except MissingUUID:
            return BytesIO(f'Capture {capture_uuid} not unavailable, try again later.'.encode())
        except NoValidHarFile:
            return BytesIO(f'No capture {capture_uuid} on the system.'.encode())
        all_paths = sorted(list(capture_dir.glob(f'*.{extension}')))
        if not all_files:
            with open(all_paths[0], 'rb') as f:
                return BytesIO(f.read())
        to_return = BytesIO()
        with ZipFile(to_return, 'w') as myzip:
            for path in all_paths:
                if path.name.endswith('pickle'):
                    continue
                myzip.write(path, arcname=f'{capture_dir.name}/{path.name}')
        to_return.seek(0)
        return to_return
def _get_raw ( self , capture_uuid : str , / , extension : str = '*' , all_files : bool = True ) -> BytesIO : try : capture_dir = self . _get_capture_dir ( capture_uuid ) except MissingUUID : return BytesIO ( f'Capture {capture_uuid} not unavailable, try again later.' . encode ( ) ) except NoValidHarFile : return BytesIO ( f'No capture {capture_uuid} on the system.' . encode ( ) ) all_paths = sorted ( list ( capture_dir . glob ( f'*.{extension}' ) ) ) if not all_files : with open ( all_paths [ 0 ] , 'rb' ) as f : return BytesIO ( f . read ( ) ) to_return = BytesIO ( ) with ZipFile ( to_return , 'w' ) as myzip : for path in all_paths : if path . name . endswith ( 'pickle' ) : continue myzip . write ( path , arcname = f'{capture_dir.name}/{path.name}' ) to_return . seek ( 0 ) return to_return
Get file(s) from the capture directory
Get file ( s ) from the capture directory
'''Get file(s) from the capture directory''' # Only get the first one in the list
self
capture_uuid
str
extension
str
all_files
bool