pycharmers.utils.ssh_utils module¶
-
class
pycharmers.utils.ssh_utils.
RemodySSHClient
(hostname: str, username: str, password: str, port: int = 22)[source]¶ Bases:
object
SSH Client for Remody Video Analysis Server.
-
connect
() → paramiko.client.SSHClient[source]¶ Create a Connection to
- Returns
A high-level representation of a session with an SSH server.
- Return type
paramiko.SSHClient
-
property
connection
¶
-
exec_command
(command: str, bufsize: int = - 1, timeout: Optional[int] = None, get_pty: bool = False, environment: Optional[dict] = None) → Tuple[str, str, str][source]¶ Execute a command on the SSH server.
- Parameters
command (str) – The command to execute.
bufsize (int, optional) – Interpreted the same way as by the built-in
file()
function in Python. Defaults to-1
.timeout (Optional[int], optional) – Set command’s channel timeout.. Defaults to
None
.get_pty (bool, optional) – Request a pseudo-terminal from the server. Defaults to
False
.environment (Optional[dict], optional) – A dict of shell environment variables, to be merged into the default environment that the remote command executes within.. Defaults to
None
.
- Returns
the stdin, stdout, and stderr of the executing command, as a 3-tuple.
- Return type
Tuple[str,str,str]
-
scp_get
(remote_path: str, local_path: str = '', recursive: bool = True, preserve_times: bool = True)[source]¶ Transfer files and directories from remote host to localhost.
- Parameters
remote_path (str) – Path to retrieve from remote host. since this is evaluated by scp on the remote host, shell wildcards and environment variables may be used.
local_path (str, optional) – Path in which to receive files locally. Defaults to
""
.recursive (bool, optional) – Transfer files and directories recursively. Defaults to
True
.preserve_times (bool, optional) – Preserve mtime and atime of transferred files and directories. Defaults to
True
.
-
scp_put
(files: Union[str, List[str]], remote_path: str = b'.', recursive: bool = True, preserve_times: bool = True)[source]¶ Transfer files and directories to remote host.
- Parameters
files (Union[str,List[str]]) – A single path, or a list of paths to be transferred.
recursive
must beTrue
to transfer directories.remote_path (str, optional) – spath in which to receive the files on the remote host. Defaults to
b"."
.recursive (bool, optional) – transfer files and directories recursively. Defaults to
True
.preserve_times (bool, optional) – preserve mtime and atime of transferred files and directories. Defaults to
True
.
-