you can use code similar to:
command = "plink.exe -ssh username@ " + hostname + " -pw password -batch \"export DISPLAY='" + hostname + "/unix:0.0' ; "
which will open ssh for the desired hostname using username and password
shutdown: command += "sudo /sbin/halt\""
reboot: command += "sudo /sbin/reboot\""
add other commands using the same method as above,
run the command with:
pid = subprocess.Popen(command).pid
As Tadek noted, this will only work on a Windows machine trying to connect to a Linux machine.
source share