@@ -27,20 +27,17 @@ def __init__(self, hostname=default_host, username=default_user, password=defaul
2727 def connect (self ):
2828 """Connects to the sftp server and returns the sftp connection object"""
2929
30- try :
31- cnopts = pysftp .CnOpts ()
32- # TODO: to be checked/removed when SSL will be setup
33- cnopts .hostkeys = None
34- # Get the sftp connection object
35- self .connection = pysftp .Connection (
36- host = self .hostname ,
37- username = self .username ,
38- password = self .password ,
39- port = self .port ,
40- cnopts = cnopts
41- )
42- except Exception as err :
43- raise Exception (err )
30+ cnopts = pysftp .CnOpts ()
31+ # TODO: to be checked/removed when SSL will be setup
32+ cnopts .hostkeys = None
33+ # Get the sftp connection object
34+ self .connection = pysftp .Connection (
35+ host = self .hostname ,
36+ username = self .username ,
37+ password = self .password ,
38+ port = self .port ,
39+ cnopts = cnopts
40+ )
4441
4542 self .is_connected = True
4643
@@ -57,18 +54,12 @@ def publish(self, source_path, remote_path) -> bool:
5754 """
5855 Publish file_content to the sftp server remote path.
5956 """
60- try :
61- self .connection .put (source_path , remote_path )
62- return True
63- except Exception as err :
64- raise Exception (err )
57+ self .connection .put (source_path , remote_path )
58+ return True
6559
6660 def remove (self , remote_path ) -> bool :
6761 """
6862
6963 """
70- try :
71- self .connection .unlink (remote_path )
72- return True
73- except Exception as err :
74- raise Exception (err )
64+ self .connection .unlink (remote_path )
65+ return True
0 commit comments