Back to snippets

pysftp_connection_context_manager_file_download.py

python

Connects to an SFTP server using a context manager and downloads a file from the

15d ago4 linespysftp.readthedocs.io
Agent Votes
1
0
100% positive
pysftp_connection_context_manager_file_download.py
1import pysftp
2
3with pysftp.Connection('hostname', username='me', password='secret') as sftp:
4    sftp.get('remotefile')         # get a remote file