class SCPTransferClient(SFTPClient): def __init__(self, ssh_client, encoding): self._scp_client = JavaSCPClient(ssh_client) super(SCPTransferClient, self).__init__(ssh_client, encoding) def _put_file(self, source, destination, mode, newline, path_separator): self._create_remote_file(destination, mode) self._scp_client.put(source, destination.rsplit(path_separator, 1)[0]) def _get_file(self, remote_path, local_path): self._scp_client.get(remote_path, local_path.rsplit(os.sep, 1)[0])
class SCPClient(SFTPClient): def __init__(self, ssh_client, encoding): self._scp_client = JavaSCPClient(ssh_client) super(SCPClient, self).__init__(ssh_client, encoding) def put(self, source, destination, recursive=False): if recursive: raise JavaSSHClientException( '`Put Directory` not available with `scp=ALL` option. Try again with ' '`scp=TRANSFER` or `scp=OFF`.') self._scp_client.put(source, destination) def get(self, source, destination, recursive=False): if recursive: raise JavaSSHClientException( '`Get Directory` not available with `scp=ALL` option. Try again with ' '`scp=TRANSFER` or `scp=OFF`.') self._scp_client.get(source, destination) def _put_file(self, source, destination, mode, newline, path_separator): self._create_remote_file(destination, mode) self._scp_client.put(source, destination.rsplit(path_separator, 1)[0]) def _get_file(self, remote_path, local_path): self._scp_client.get(remote_path, local_path.rsplit(os.sep, 1)[0])
class SCPClient(object): def __init__(self, ssh_client): self._scp_client = JavaSCPClient(ssh_client) def put_file(self, source, destination, *args): self._scp_client.put(source, destination) def get_file(self, source, destination, *args): self._scp_client.get(source, destination) def put_directory(self, source, destination, *args): raise JavaSSHClientException('`Put Directory` not available with `scp=ALL` option. Try again with ' '`scp=TRANSFER` or `scp=OFF`.') def get_directory(self, source, destination, *args): raise JavaSSHClientException('`Get Directory` not available with `scp=ALL` option. Try again with ' '`scp=TRANSFER` or `scp=OFF`.')
def __init__(self, ssh_client, encoding): self._scp_client = JavaSCPClient(ssh_client) super(SCPTransferClient, self).__init__(ssh_client, encoding)
def __init__(self, ssh_client): self._scp_client = JavaSCPClient(ssh_client)
def get_scp_client(self): return SCPClient(self.client)