我正在测试提供程序提供的服务,您可以在其中获取新的tickdata。没有API,但是您必须通过ssh登录以获得在ssh窗口中每秒更新的tickdata。 如何将滴答数据获取到计算机上的本地文件? 我试过了-
import base64
import paramiko
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('rt01.rtfxd.com',port="6174", username='rt01.demo', password='rtfxd')
stdin, stdout, stderr = client.exec_command('cat /proc/meminfo')
for line in stdout:
print('... ' + line.strip('\n'))
client.close()
但是它根本没有给我任何输出。该提要来自www.rtfxd.com,并且登录仅用于演示目的。 任何解决该问题的想法将不胜感激。
答案 0 :(得分:0)
stdin, stdout, stderr
是类似文件的对象,请尝试:
while True:
print(stdout.read().decode(), end='')
if stdout.channel.exit_status_ready():
break