Advertisement
Guest User

Untitled

a guest
Apr 7th, 2017
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. import pysftp
  2.  
  3. DOWNLOAD = {
  4. "USERNAME": "username",
  5. "PASSWORD": "password"
  6. }
  7.  
  8. FTP_SITE = 'sftp.mysite.com'
  9.  
  10. srv = pysftp.Connection(host=FTP_SITE, username=DOWNLOAD['USERNAME'],
  11. password=DOWNLOAD['PASSWORD']
  12.  
  13. ---------------------------------------------------------------------------
  14. SSHException Traceback (most recent call last)
  15. <ipython-input-47-205bb7b4b59b> in <module>()
  16. 5
  17. 6 srv = pysftp.Connection(host=FTP_SITE, username=DOWNLOAD['USERNAME'],
  18. ----> 7 password=DOWNLOAD['PASSWORD'])
  19.  
  20. C:UsersAlexAnaconda2libsite-packagespysftp__init__.pyc in __init__(self, host, username, private_key, password, port, private_key_pass, ciphers, log, cnopts, default_path)
  21. 130 # check that we have a hostkey to verify
  22. 131 if self._cnopts.hostkeys is not None:
  23. --> 132 self._tconnect['hostkey'] = self._cnopts.get_hostkey(host)
  24. 133
  25. 134 self._sftp_live = False
  26.  
  27. C:UsersAlexAnaconda2libsite-packagespysftp__init__.pyc in get_hostkey(self, host)
  28. 69 kval = self.hostkeys.lookup(host) # None|{keytype: PKey}
  29. 70 if kval is None:
  30. ---> 71 raise SSHException("No hostkey for host %s found." % host)
  31. 72 # return the pkey from the dict
  32. 73 return list(kval.values())[0]
  33.  
  34. SSHException: No hostkey for host sftp.mysite.com found.
  35.  
  36. cnopts = pysftp.CnOpts()
  37. cnopts.hostkeys = None
  38. srv = pysftp.Connection(host=FTP_SITE, username=DOWNLOAD['USERNAME'],
  39. password=DOWNLOAD['PASSWORD'], cnopts=cnopts)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement