SFTPClient::upload_file(): add remote_filename & remote_filepath arguments
Some checks failed
Run tests / tests (push) Failing after 1m26s
Some checks failed
Run tests / tests (push) Failing after 1m26s
This commit is contained in:
parent
6ccea48b23
commit
552c202fc4
1 changed files with 6 additions and 4 deletions
|
@ -131,12 +131,14 @@ class SFTPClient(ConfigurableObject):
|
||||||
log.debug("Remotly open file '%s'", remote_filepath)
|
log.debug("Remotly open file '%s'", remote_filepath)
|
||||||
return self.sftp_client.open(remote_filepath, mode=mode)
|
return self.sftp_client.open(remote_filepath, mode=mode)
|
||||||
|
|
||||||
def upload_file(self, filepath, remote_directory=None):
|
def upload_file(
|
||||||
|
self, filepath, remote_filename=None, remote_directory=None, remote_filepath=None
|
||||||
|
):
|
||||||
"""Upload a file on SFTP server"""
|
"""Upload a file on SFTP server"""
|
||||||
self.connect()
|
self.connect()
|
||||||
remote_filepath = os.path.join(
|
remote_filepath = remote_filepath or os.path.join(
|
||||||
remote_directory if remote_directory else self.initial_directory,
|
remote_directory or self.initial_directory,
|
||||||
os.path.basename(filepath),
|
remote_filename or os.path.basename(filepath),
|
||||||
)
|
)
|
||||||
log.debug("Upload file '%s' to '%s'", filepath, remote_filepath)
|
log.debug("Upload file '%s' to '%s'", filepath, remote_filepath)
|
||||||
if self._just_try:
|
if self._just_try:
|
||||||
|
|
Loading…
Reference in a new issue