def sftp(
    task: Task, src: str, dst: str, action: str, dry_run: Optional[bool] = None
) -> Result:
    """
    Transfer files from/to the device using sftp protocol

    Example::

        nornir.run(files.sftp,
                    action="put",
                    src="README.md",
                    dst="/tmp/README.md")

    Arguments:
        dry_run: Whether to apply changes or not
        src: source file
        dst: destination
        action: ``put``, ``get``.

    Returns:
        Result object with the following attributes set:
          * changed (``bool``):
          * files_changed (``list``): list of files that changed
    """
    dry_run = task.is_dry_run(dry_run)
    actions = {"put": put, "get": get}
    client = task.host.get_connection("paramiko", task.nornir.config)
    scp_client = SCPClient(client.get_transport())
    sftp_client = paramiko.SFTPClient.from_transport(client.get_transport())
    files_changed = actions[action](task, scp_client, sftp_client, src, dst, dry_run)
    return Result(
        host=task.host, changed=bool(files_changed), files_changed=files_changed
    )
def sftp ( task : Task , src : str , dst : str , action : str , dry_run : Optional [ bool ] = None ) -> Result : dry_run = task . is_dry_run ( dry_run ) actions = { "put" : put , "get" : get } client = task . host . get_connection ( "paramiko" , task . nornir . config ) scp_client = SCPClient ( client . get_transport ( ) ) sftp_client = paramiko . SFTPClient . from_transport ( client . get_transport ( ) ) files_changed = actions [ action ] ( task , scp_client , sftp_client , src , dst , dry_run ) return Result ( host = task . host , changed = bool ( files_changed ) , files_changed = files_changed )
Transfer files from/to the device using sftp protocol

    Example::

        nornir.run(files.sftp,
                    action="put",
                    src="README.md",
                    dst="/tmp/README.md")

    Arguments:
        dry_run: Whether to apply changes or not
        src: source file
        dst: destination
        action: ``put``, ``get``.

    Returns:
        Result object with the following attributes set:
          * changed (``bool``):
          * files_changed (``list``): list of files that changed