From 6adcc1eeed187893cbf4ff2eb1492a26e3b8b234 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 30 Jun 2022 14:46:43 +0200 Subject: [PATCH] SFTP client: add missing connect() call in get_file and open_file methods --- mylib/sftp.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mylib/sftp.py b/mylib/sftp.py index b323de5..5187251 100644 --- a/mylib/sftp.py +++ b/mylib/sftp.py @@ -103,11 +103,13 @@ class SFTPClient(ConfigurableObject): def get_file(self, remote_filepath, local_filepath): """ Retrieve a file from SFTP server """ + self.connect() log.debug("Retreive file '%s' to '%s'", remote_filepath, local_filepath) return self.sftp_client.get(remote_filepath, local_filepath) is None def open_file(self, remote_filepath, mode='r'): """ Remotly open a file on SFTP server """ + self.connect() log.debug("Remotly open file '%s'", remote_filepath) return self.sftp_client.open(remote_filepath, mode=mode)