@ -114,7 +114,7 @@ class Connection(ConnectionBase):
try :
cmd = json . loads ( to_text ( cmd , errors = ' surrogate_or_strict ' ) )
kwargs = { ' command ' : to_bytes ( cmd [ ' command ' ] , errors = ' surrogate_or_strict ' ) }
for key in ( ' prompt ' , ' answer ' , ' send _ only' ) :
for key in ( ' prompt ' , ' answer ' , ' send only' ) :
if cmd . get ( key ) is not None :
kwargs [ key ] = to_bytes ( cmd [ key ] , errors = ' surrogate_or_strict ' )
return self . send ( * * kwargs )
@ -270,7 +270,6 @@ class Connection(ConnectionBase):
recv . seek ( offset )
window = self . _strip ( recv . read ( ) )
if prompts and not handled :
handled = self . _handle_prompt ( window , prompts , answer )
@ -279,14 +278,14 @@ class Connection(ConnectionBase):
resp = self . _strip ( self . _last_response )
return self . _sanitize ( resp , command )
def send ( self , command , prompt = None , answer = None , send _ only= False ) :
def send ( self , command , prompt = None , answer = None , send only= False ) :
'''
Sends the command to the device in the opened shell
'''
try :
self . _history . append ( command )
self . _ssh_shell . sendall ( b ' %s \r ' % command )
if send _ only:
if send only:
return
response = self . receive ( command , prompt , answer )
return to_text ( response , errors = ' surrogate_or_strict ' )