(self, container_name: str, file_path: str)
Retrieve an object from swift, base64 decoding the contents.
Retrieve an object from swift, base64 decoding the contents.
Retrieve an object from swift base64 decoding the contents .
def get_object(self, container_name: str, file_path: str) -> bytes:
        """Retrieve an object from swift, base64 decoding the contents."""
        with self.connection() as conn:
            try:
                _, file_contents = conn.get_object(container_name, file_path)
            except swiftclient.exceptions.ClientException:
                raise FileNotFoundError(file_path)
            else:
                if len(file_contents) % 4 == 0 and BASE64_RE.fullmatch(file_contents):
                    return base64.b64decode(file_contents)
                return bytes(file_contents)
def get_object ( self , container_name : str , file_path : str ) -> bytes : with self . connection ( ) as conn : try : _ , file_contents = conn . get_object ( container_name , file_path ) except swiftclient . exceptions . ClientException : raise FileNotFoundError ( file_path ) else : if len ( file_contents ) % 4 == 0 and BASE64_RE . fullmatch ( file_contents ) : return base64 . b64decode ( file_contents ) return bytes ( file_contents )