1import asyncio, asyncssh, sys
2
3async def run_client():
4 async with asyncssh.connect('localhost') as conn:
5 result = await conn.run('echo "Hello!"', check=True)
6 print(result.stdout, end='')
7
8try:
9 asyncio.get_event_loop().run_until_complete(run_client())
10except (OSError, asyncssh.Error) as exc:
11 sys.exit('SSH connection failed: ' + str(exc))