我想从Robot nao下载文件/recordings/cameras
到我的电脑。
我怎样才能做到这一点 ?请给我一个例子(脚本)。
答案 0 :(得分:1)
你可以使用Paramiko包。
import paramiko
NAO_IP = "put_nao_ip_here"
NAO_USERNAME = "put_nao_username_here"
NAO_PASSWORD = "put_nao_password_here"
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(NAO_IP, username=NAO_USERNAME, password=NAO_PASSWORD)
sftp = ssh.open_sftp()
localpath = 'path to save the file locally with filename'
remotepath = '/recordings/cameras/<filename>'
sftp.get(remotepath, localpath)
sftp.close()
ssh.close()