Paramiko resource shortage error - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Networking (https://python-forum.io/forum-12.html) +--- Thread: Paramiko resource shortage error (/thread-25749.html) |
Paramiko resource shortage error - michu7 - Apr-10-2020 I want to log into a router from a gateway switch and then pass commands to get the logs of the router Made a script for the same butting receiving " Paramiko resource shortage error " \ ### SCRIPT #### import paramiko import getpass import time Host = "199.52.39.1" ## This is the gateway IP username = "a2201471-3" password = "RoXS5f+em9%Tjo=" ssh_client = paramiko.SSHClient() ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh_client.connect(hostname=Host, username=username, password=password) print("Successfully Connected\n") cmd = "Ssh -l gakr_mnsey 10.251.13.241" #### This is my username and the router IP remote_connection = ssh_client.invoke_shell() stdin, stdout, stderr = ssh_client.exec_command(cmd,get_pty=True) stdin.write('4cLs=P2j\n') stdin.flush() time.sleep(1) stdin.write('sh ip bgp summ | b Nei\n') stdin.flush() remote_connection.send('sh ip bgp summ | b Nei\n') print(stdout.read()) time.sleep(1) ssh_client.close##### Error ########
|