AsyncSSH is a Python package which provides an asynchronous client and server implementation of the SSHv2 protocol on top of the Python 3.6+ asyncio framework.
import asyncio , asyncssh , sys async def run_client (): async with asyncssh . connect ( 'localhost' ) as conn : result = await conn . run ( 'echo "Hello!"' , check = True ) print ( result . stdout , end = '' ) try : asyncio . get_event_loop () . run_until_complete ( run_client ()) except ( OSError , asyncssh . Error ) as exc : sys . exit ( 'SSH connection failed: ' + str ( exc )) Check out the examples to get started!
Full support for SSHv2, SFTP, and SCP client and server functions