I found bunch of information about how put file if you DON'T have a hostkey,
But couldn't find anything about How to put file on SFTP server having a hostkey.
So I have my hostkey . Where should I place it in a code?
import pysftp as sftp
def sftpExample():
try:
hostkey = '12345642121' # My hostkey
s = sftp.Connection(host='Host.com',username='MuUserName',password='MyPassword')
remotepath = 'path/Example/TestFile.txt'
localpath = r'\\Path\Example\TestFile.txt'
s.put(localpath,remotepath)
s.close()
except Exception as e:
print (str(e))
sftpExample()