mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-25 12:22:28 +03:00
File transfer method improvements
This commit is contained in:
parent
e0800d0ac1
commit
9a0080e88d
1 changed files with 12 additions and 5 deletions
|
@ -39,11 +39,18 @@ class Context(object):
|
||||||
self.data['responseData'] = data
|
self.data['responseData'] = data
|
||||||
self.data['contentType'] = content_type
|
self.data['contentType'] = content_type
|
||||||
|
|
||||||
def fetch_file(self, local_path=None):
|
def fetch_file(self, remote_path, local_path=None, file_name=None):
|
||||||
file_manager = FileTransferManager(self.get('protocol'), self.get('parameter_map'))
|
success = None
|
||||||
file_manager.transporter.connect()
|
try:
|
||||||
success = file_manager.transporter.get_file(local_path)
|
custom_map = self.get('parameterMap')
|
||||||
file_manager.transporter.disconnect()
|
custom_map['path'] = remote_path
|
||||||
|
file_manager = FileTransferManager(self.get('protocol'), custom_map)
|
||||||
|
file_manager.transporter.connect()
|
||||||
|
success = file_manager.transporter.get_file(local_path, file_name)
|
||||||
|
file_manager.transporter.disconnect()
|
||||||
|
except Exception as e:
|
||||||
|
raise
|
||||||
|
|
||||||
return success
|
return success
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue