ace.tools.sftp.utils
- class ace.tools.sftp.utils.SFTPConnector(host: str = '', username: str = '', password: str = '', private_key: str = '', port: str | int = 22, auth_method: str = 'password')[source]
Bases:
object- __init__(host: str = '', username: str = '', password: str = '', private_key: str = '', port: str | int = 22, auth_method: str = 'password')[source]
- connect() None[source]
- disconnect()[source]
- password_auth() None[source]
- private_key_auth() None[source]
- ace.tools.sftp.utils.upload(sftp_connector: SFTPConnector, file_obj, remote_path: str)[source]
Upload a file to the SFTP server. Raises FileExistsError if a file already exists at remote_path.
- ace.tools.sftp.utils.upload_overwrite(sftp_connector: SFTPConnector, file_obj, remote_path: str)[source]
Upload a file to the SFTP server, overwriting any existing file at remote_path.
- ace.tools.sftp.utils.download(sftp_connector: SFTPConnector, file_name: str)[source]
Download a file from the SFTP server and return its content as bytes.
- ace.tools.sftp.utils.move(sftp_connector: SFTPConnector, current_path: str, new_path: str)[source]
Move a file on the SFTP server. Raises FileExistsError if a file already exists at new_path.
- ace.tools.sftp.utils.move_overwrite(sftp_connector: SFTPConnector, current_path: str, new_path: str)[source]
Move a file on the SFTP server, overwriting any existing file at new_path.