In [1]:
import pysftp
In [8]:
HOST = 'cysecure.cityyear.org'
USER = 'yourusernamehere'
PASS = 'p@$$w0rd'
# If I didn't set hostkeys to None, then I would get an
# error about cysecure not having a specified hostkey
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
srv = pysftp.Connection(host=HOST, username=USER, password=PASS, cnopts=cnopts)
In [9]:
# list the directories available
srv.listdir()
Out[9]:
In [11]:
# Download all files in the FY18 directory to a folder called 'local-copy'
srv.get_d('FY18', 'local-copy', preserve_mtime=True)
In [ ]: