我尝试使用python类,下面是我的第一个python类代码:import re
import time
import paramiko
hostname = "10.1.1.1"
net_username = "user"
net_password = "password"
class asr_qa:
def __init__(self, hostname, net_username, net_password):
''' SSH connection Establish '''
self.remote_conn_pre = paramiko.SSHClient()
self.remote_conn_pre.set_missing_host_key_policy(
paramiko.AutoAddPolicy())
self.remote_conn_pre.connect(hostname, username=net_username,
password=net_password,look_for_keys=False, allow_agent=False)
self.remote_conn = remote_conn_pre.invoke_shell()
buff = ''
while not buff.endswith('#'):
resp = remote_conn.recv(9999)
buff += resp
print(resp)
def __disconnect__(sel