platypush/plugins/esp/__init__.py
def file_get(self, file: str, binary: bool = False, timeout: Optional[float] = 60.0, **kwargs) -> str:
        """
        Get the content of a file on the board.

        :param file: File name/path to get from the device.
        :param binary: If True, then the base64-encoded content of the file will be returned.
        :param timeout: File transfer timeout (default: one minute).
        :param kwargs: Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.connect`.
        """
        device = self._get_device(**kwargs)
        host = device['host']
        port = device['port']
        self.connect(host=host, port=port, password=device['password'])
        conn = self._get_connection(host=host, port=port)

        with io.BytesIO() as buffer:
            conn.file_download(file, buffer, timeout=timeout)
            data = buffer.getvalue()

        if binary:
            data = base64.encodebytes(data).decode()
        else:
            data = data.decode()

        return data

        Get the content of a file on the board.

        :param file: File name/path to get from the device.
        :param binary: If True, then the base64-encoded content of the file will be returned.
        :param timeout: File transfer timeout (default: one minute).
        :param kwargs: Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.connect`.
        
Get the content of a file on the board.
Get the content of a file on the board .
def file_get(self, file: str, binary: bool = False, timeout: Optional[float] = 60.0, **kwargs) -> str:
        device = self._get_device(**kwargs)
        host = device['host']
        port = device['port']
        self.connect(host=host, port=port, password=device['password'])
        conn = self._get_connection(host=host, port=port)
        with io.BytesIO() as buffer:
            conn.file_download(file, buffer, timeout=timeout)
            data = buffer.getvalue()
        if binary:
            data = base64.encodebytes(data).decode()
        else:
            data = data.decode()
        return data
def file_get ( self , file : str , binary : bool = False , timeout : Optional [ float ] = 60.0 , ** kwargs ) -> str : device = self . _get_device ( ** kwargs ) host = device [ 'host' ] port = device [ 'port' ] self . connect ( host = host , port = port , password = device [ 'password' ] ) conn = self . _get_connection ( host = host , port = port ) with io . BytesIO ( ) as buffer : conn . file_download ( file , buffer , timeout = timeout ) data = buffer . getvalue ( ) if binary : data = base64 . encodebytes ( data ) . decode ( ) else : data = data . decode ( ) return data
Get the content of a file on the board.
Get the content of a file on the board .
"""
        Get the content of a file on the board.

        :param file: File name/path to get from the device.
        :param binary: If True, then the base64-encoded content of the file will be returned.
        :param timeout: File transfer timeout (default: one minute).
        :param kwargs: Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.connect`.
        """
self
file
str
File name/path to get from the device.
File name / path to get from the device .
binary
bool
If True, then the base64-encoded content of the file will be returned.
If True then the base64 - encoded content of the file will be returned .
timeout
Optional[float]
File transfer timeout (default: one minute).
File transfer timeout ( default : one minute ) .
kwargs
Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.connect`.
Parameters to pass to : meth : ` platypush . plugins . esp . EspPlugin . connect ` .