Below functions, I am creating the ssh client and trying to save it to django session object.
def create_ssh_client(host, user, password):
client = SSHClient()
client.load_system_host_keys()
client.connect(host,
username=user,
password=password,
timeout=5000,
)
return client
def save_to_session(request):
ssh_client = create_ssh_client(host, user, password)
request.session['ssh_client'] = ssh_client
** While trying to save to session, getting the type error -**
TypeError: Object of type SSHClient is not JSON serializable
Any suggestion or input appreciated.
use SSHClient in django
create_ssh_clientfunction to return a dictionary containing the necessary information about the SSH client: