Guest User

Untitled

a guest
Jun 8th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import pysftp
  2. import os
  3.  
  4. cnopts = pysftp.CnOpts()
  5. cnopts.hostkeys = None
  6.  
  7. host = 'somehost'
  8. port = 22
  9. user = 'someuser'
  10. password ='samplepass'
  11.  
  12. with pysftp.Connection(
  13. host=host,
  14. port=port,
  15. username=user,
  16. password=password,
  17. cnopts=cnopts
  18. ) as sftp:
  19. sftp_client = sftp
  20. path = 'root_folder'
  21. file_list_attr = sftp.listdir_attr(remotepath=path)
  22. file_stat = sftp.stat(os.path.join(path, 'file.txt'))
Add Comment
Please, Sign In to add comment