Connect to SFTP with key file using Python pysftp
I need to connect to a SFTP, download the most recent file, then change the file name and load again to the same SFTP folder and delete the 'original name' file. I have done this with FTP with user and password, however in this case, the SFTP has a key file (.ppk). How can set the key file as password? Thank you! import pysftp srv = pysftp.Connection(host="your_FTP_server", username="your_username", password="your_password") # Get the directory and file listing data = srv.listdir() # Closes the connection srv.close() # Prints out the directories and files, line by line for i in data: print i