{"id":22357,"library":"sftpretty","title":"sftpretty","description":"A pretty, simple SFTP wrapper around paramiko with a high-level API for secure file transfer. Current version is 1.2.1, requires Python >=3.6. Release cadence is occasional, with recent releases roughly every few months.","status":"active","version":"1.2.1","language":"python","source_language":"en","source_url":"https://github.com/byteskeptical/sftpretty","tags":["sftp","ssh","file-transfer","paramiko-wrapper","ftps"],"install":[{"cmd":"pip install sftpretty","lang":"bash","label":"Standard install"}],"dependencies":[{"reason":"Core SSH/SFTP protocol implementation","package":"paramiko","optional":false}],"imports":[{"note":"","wrong":"","symbol":"CnOpts","correct":"from sftpretty import CnOpts"},{"note":"","wrong":"","symbol":"Connection","correct":"from sftpretty import Connection"},{"note":"","wrong":"","symbol":"SFTPError","correct":"from sftpretty import SFTPError"}],"quickstart":{"code":"from sftpretty import Connection\ncnopts = CnOpts()\ncnopts.hostkeys = None  # disable host key checking (for demo only)\nwith Connection('example.com', username='user', password='pass', cnopts=cnopts) as sftp:\n    sftp.listdir()\n    print('Connected')","lang":"python","description":"Basic connection and directory listing. Disables host key verification for simplicity; use proper hostkeys in production."},"warnings":[{"fix":"Review paramiko's license implications before incorporating into proprietary software.","message":"sftpretty uses paramiko under the hood, so it inherits paramiko's GPL license. Ensure your project is compatible.","severity":"gotcha","affected_versions":"all"},{"fix":"Perform all file operations inside the with block.","message":"When using connection as a context manager (with statement), the connection closes upon exit. Do not attempt to use sftp object after the block ends.","severity":"gotcha","affected_versions":"all"},{"fix":"from sftpretty import CnOpts; cnopts = CnOpts(); Connection(..., cnopts=cnopts)","message":"The 'cnopts' parameter in Connection constructor expects a CnOpts object; passing a dict is deprecated in some versions. Use CnOpts() explicitly.","severity":"deprecated","affected_versions":">=1.2.0"},{"fix":"Load known hosts file with cnopts.hostkeys.load('path/to/known_hosts') or set cnopts.hostkeys = None for testing only.","message":"Host key checking is enabled by default. If you don't have the server's host key, the connection will fail. Use cnopts.hostkeys = None to disable (insecure) or cnopts.hostkeys.load('known_hosts') to add keys.","severity":"gotcha","affected_versions":"all"},{"fix":"Change imports to `from sftpretty import Connection` and use `Connection(...)` directly.","message":"In version 1.0.0, the API changed from `sftpretty.Connection(...)` to `Connection(...)` (import changes). Older code using `from sftpretty import sftpretty` will break.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"from sftpretty import Connection","cause":"Old import style (from sftpretty import sftpretty; sftpretty.Connection) used with sftpretty >=1.0.0 where API changed.","error":"AttributeError: module 'sftpretty' has no attribute 'Connection'"},{"fix":"Use `from sftpretty import CnOpts`; ensure sftpretty version >=1.0.0.","cause":"Attempting to import CnOpts from a wrong location or an older version lacking that class.","error":"ImportError: cannot import name 'CnOpts'"},{"fix":"Either disable host key checking (cnopts.hostkeys = None) or load the known_hosts file with cnopts.hostkeys.load('path/to/known_hosts').","cause":"Host key verification fails because the server's host key is not in the known_hosts file.","error":"SSHException: Server 'example.com' not found in known_hosts"},{"fix":"Use connection = Connection('example.com:22', username='user', password='pass') or separate port argument? Actually sftpretty does accept port as an integer argument in version 1.2.x. Check docs. If error persists, use host:port format.","cause":"Connection constructor does not accept a 'port' argument; port is specified via hostname like 'host:port' or via the 'port' keyword in older paramiko but sftpretty expects it in the host string.","error":"TypeError: __init__() got an unexpected keyword argument 'port'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}