Answers for "sftp python"

2

python connect sftp

import pysftp
import sys

path = './THETARGETDIRECTORY/' + sys.argv[1]    #hard-coded
localpath = sys.argv[1]

host = "THEHOST.com"                    #hard-coded
password = "THEPASSWORD"                #hard-coded
username = "THEUSERNAME"                #hard-coded

with pysftp.Connection(host, username=username, password=password) as sftp:
    sftp.put(localpath, path)

print 'Upload done.'
Posted by: Guest on May-14-2020
0

sftp python

pip install pysftp
Posted by: Guest on August-19-2021

Python Answers by Framework

Browse Popular Code Answers by Language