Simple ssh client with asyncssh for network devices
Project description
nw-ssh
Simple ssh client with asyncssh for network devices.
import asyncio
from nw_ssh import connection
async def main():
async with connection.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)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Requirements
- Python >= 3.6
- 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.3.tar.gz
(3.3 kB
view hashes)
Built Distribution
nw_ssh-1.0.3-py3-none-any.whl
(3.4 kB
view hashes)