客户端的exec_command和Paramiko通道的区别?

问题描述 投票:0回答:1

Python包Paramiko中,

exec_command
channel.py
中存在
client.py
方法,它们有什么区别?

python ssh paramiko
1个回答
0
投票

Channel
是一个低级 API,一般情况下不应使用。

SSHClient.exec_command
调用
Channel.exec_command
,然后创建
stdin
/
stdout
/
stderr
对象并将它们作为三元组返回。使用
Channel
,您必须自己创建这些对象(因为没有它们,
Channel.exec_command
是无用的)。

另请参阅 Paramiko exec_command 因“NoneType”对象不可迭代而失败

此外,

SSHClient.exec_command
还有
get_pty
environment
参数,分别触发
Channel.get_pty()
Channel.update_environment

检查

SSHClient.exec_command
源代码

© www.soinside.com 2019 - 2024. All rights reserved.