SFTP client Python package that uses paramiko library.
From a script:
import fileshiftlib
host = "localhost"
username = "123..."
password = "xxxx"
port = 22
# Initialize SFTP client
sftp = fileshiftlib.SFTP(
host=host,
username=username,
password=password,
port=port,
logger=None
)sftp.reconnect()ftp_status = sftp.is_connected()
print(ftp_status)content_list = sftp.list_dir()
print(content_list)sftp.change_dir(path=".")sftp.delete_file(filename=r"demo.txt")sftp.download_file(
remote_path=r"/demo/demo.txt",
local_path=r"c:\local\demo.txt"
)sftp.upload_file(
local_path=r"c:\local\demo.txt",
remote_path=r"/demo/demo.txt"
)Install python and pip if you have not already.
Then run:
pip install pip --upgradeFor production:
pip install fileshiftlibThis will install the package and all of it's python dependencies.
If you want to install the project for development:
git clone https://github.com/aghuttun/fileshiftlib.git
cd fileshiftlib
pip install -e ".[dev]"The script's docstrings follow the numpydoc style.
BSD License (see license file)