from fabric import Connection from util import find_data_file from util import setup_child from util import fprint def sftp_send_data(res, config, filename): setup_child() fprint("Connecting over SSH to " + config['sftp']['host']) c = Connection(host=config['sftp']['host'], user=config['sftp']['user'], port=config['sftp']['port'], connect_kwargs={"key_filename": find_data_file(config['sftp']['keyfile']),}) fprint("Sending data over SFTP: " + filename) fprint(c.put(find_data_file(filename), remote=config['sftp']['filepath']['send'])) fprint("Data sent over SFTP sucessfully") #command = 'ls ' + config['sftp']['filepath']['send'] #fprint(c.run(command))