In order to connect via SSH I'm using the following code:
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(IP, username=USER, password=PSW,look_for_keys=False)
my question is, how can I handle a missing connection? In particular I'd like that in case the connection is not established the code goes (maybe with a GOTO?) to another point of the code where basically I restart the server.