Guest User

Untitled

a guest
Jan 3rd, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. class sftp:
  2. def __init__(self):
  3. self.response = HttpResponse()
  4. self.cnopts = pysftp.CnOpts()
  5. self.cnopts.hostkeys = None
  6. def dl(self):
  7. with pysftp.Connection('host.exmaple.com', username='user1', password='test_password',
  8. cnopts=self.cnopts) as sftp:
  9. sftp.getfo(
  10. '/var/lib/stuff/file.mp3',
  11. self.response)
  12. self.response['Content-Type'] = 'audio/mp3'
  13. return self.response
  14.  
  15. return sftp().download()
Add Comment
Please, Sign In to add comment