Skip to main content

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


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 details)

Uploaded Source

Built Distribution

nw_ssh-1.0.4-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file nw-ssh-1.0.4.tar.gz.

File metadata

  • Download URL: nw-ssh-1.0.4.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.10 Windows/10

File hashes

Hashes for nw-ssh-1.0.4.tar.gz
Algorithm Hash digest
SHA256 d6d4ea422c753fe45fcb3c26d6efbdaf4cc1f57fb0015ad575cbc82d0ac48596
MD5 715cfe634587307ca58cf0a60e133409
BLAKE2b-256 e747806ba57039668749eeb74255b72e2d2c16bae963d97d756b897f587e89c5

See more details on using hashes here.

File details

Details for the file nw_ssh-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: nw_ssh-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.10 Windows/10

File hashes

Hashes for nw_ssh-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a7215d01d88a313bc0359b7b02c8060728b460574fccc571498d3eae18531aa5
MD5 f262e45f3a8ce3b680bd5a5ddead84a3
BLAKE2b-256 601b4c26647ff25286cfd65b17358658b404f4295f0256f48baaf7caf270207e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page