Skip to content

Instantly share code, notes, and snippets.

@dbrrt
Last active September 25, 2019 12:43
Show Gist options
  • Select an option

  • Save dbrrt/24edf7fe7865d79f02a0356c9a8bf368 to your computer and use it in GitHub Desktop.

Select an option

Save dbrrt/24edf7fe7865d79f02a0356c9a8bf368 to your computer and use it in GitHub Desktop.
from fs.sshfs import SSHFS
host = '192.168.1.10'
remote_path = '/home/jovyan/dev/test-fs-sshfs/requirements.txt'
remote_fs = SSHFS(
host, user='david', passwd='test', pkey=None, timeout=10, port=22,
keepalive=10, compress=False, config_path='~/.ssh/config'
)
remote_file = remote_fs.openbin(remote_path)
line = remote_file.readline()
while line:
try:
line = line.decode('utf8')
print (line.strip())
except:
pass
line = remote_file.readline()
remote_file.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment