Simple ssh client with asyncssh for network devices
Project description
nw-ssh
Simple ssh client with asyncssh for network devices.
import asyncio
import nw_ssh
async def main() -> None:
async with nw_ssh.SSHConnection(
host='169.254.0.1',
port=22,
username='root',
password='password',
client_keys=[],
passphrase=None,
known_hosts_file=None,
delimiter=r'#',
timeout=10,
) as conn:
print(conn.login_message)
output = await conn.send(input='cli', delimiter=r'>')
print(output)
output = await conn.send(input='show interfaces fxp0 | no-more', delimiter=r'>')
print(output)
output = await conn.send(input='configure', delimiter=r'#')
print(output)
output = await conn.send(input='show interfaces', delimiter=r'#')
print(output)
output = await conn.send(input='commit', delimiter=r'#', timeout=10)
print(output)
asyncio.run(main())
Requirements
- Python >= 3.7
- asyncssh
Installation
pip install nw-ssh
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nw-ssh-1.0.4.tar.gz
(3.5 kB
view hashes)
Built Distribution
nw_ssh-1.0.4-py3-none-any.whl
(3.9 kB
view hashes)