Skip to main content

ssh_session_manager

Execute commands on multiple remote SSH sessions

PyPI

Example 1: Using the SSHSession

from ssh_session_manager.Command import Command
from ssh_session_manager.SSHSession import SSHSession


ls_command = Command("ls -la")
ps_command = Command("ps -ax")

commands = [
    ls_command,
    ps_command
]

with SSHSession("Silver Server", "10.0.0.57", "user", "password") as ssh_session:
    for command in commands:
        ssh_session.run_command_in_ssh_session(command)

command_output_dictionary = ssh_session.get_command_output_dictionary(ps_command)

standard_output_lines = command_output_dictionary["standard_output_lines"]
standard_error_lines = command_output_dictionary["standard_error_lines"]
exit_status = command_output_dictionary["exit_status"]

Example 2: Using the SSHSessionManager

from ssh_session_manager.Command import Command
from ssh_session_manager.SSHSession import SSHSession
from ssh_session_manager.SSHSessionManager import SSHSessionManager


ssh_session_1 = SSHSession("Silver Server", "10.0.0.57", "user", "password")
ssh_session_2 = SSHSession("Black Server", "10.0.0.58", "user", "password")

ssh_sessions = [
    ssh_session_1,
    ssh_session_2
]

ls_command = Command("ls -la")
ps_command = Command("ps -ax")

commands = [
    ls_command,
    ps_command
]

with SSHSessionManager(ssh_sessions) as ssh_session_manager
    ssh_session_manager.run_commands_in_ssh_sessions(commands)

command_output_dictionary = ssh_session_manager.get_command_output_dictionary(ssh_session_1, ls_command)

standard_output_lines = command_output_dictionary["standard_output_lines"]
standard_error_lines = command_output_dictionary["standard_error_lines"]
exit_status = command_output_dictionary["exit_status"]

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ssh-session-manager-0.5.1.tar.gz (5.6 kB view details)

Uploaded Source

File details

Details for the file ssh-session-manager-0.5.1.tar.gz.

File metadata

  • Download URL: ssh-session-manager-0.5.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.12

File hashes

Hashes for ssh-session-manager-0.5.1.tar.gz
Algorithm Hash digest
SHA256 3678d79c0dabc8dbef5839f6207712638e9622ef2d9919dc5badf2e95410d84f
MD5 9cfbdb86f004c8261fe0c47f181c0991
BLAKE2b-256 4008ea69dcfdd17d63f619b28c0d24ff85d63f5da130205091117b57c506140e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.1 This release

1 file

0.5.0

1 file

0.4.0

1 file

0.3.1

1 file

0.3.0

1 file

0.2.0

1 file

0.1.0

1 file

0.0.2

1 file

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page