Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class sftp:
- def __init__(self):
- self.response = HttpResponse()
- self.cnopts = pysftp.CnOpts()
- self.cnopts.hostkeys = None
- def dl(self):
- with pysftp.Connection('host.exmaple.com', username='user1', password='test_password',
- cnopts=self.cnopts) as sftp:
- sftp.getfo(
- '/var/lib/stuff/file.mp3',
- self.response)
- self.response['Content-Type'] = 'audio/mp3'
- return self.response
- return sftp().download()
Add Comment
Please, Sign In to add comment