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


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

Uploaded Source

Built Distribution

nw_ssh-1.0.3-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nw-ssh-1.0.3.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.2 CPython/3.8.3 Windows/10

File hashes

Hashes for nw-ssh-1.0.3.tar.gz
Algorithm Hash digest
SHA256 2943f56905597b1a9ac7c7a11e189161767d6ac9739f0e7c84c6e9958db3b9c0
MD5 dd1dab2ffdd0570494538e1a57118191
BLAKE2b-256 a1472d5d30ae42663348598481f8d8598e32a469d4b4190c04d5d67c0a7dac80

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nw_ssh-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.2 CPython/3.8.3 Windows/10

File hashes

Hashes for nw_ssh-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8167cc3fc1782fb9f3a9c363454fa59fe09a1bd15d19c440e5fac0ad10c983ea
MD5 3c1e9d3c772c21b013756f81c536b4b7
BLAKE2b-256 cca9659ab15e763624a6163263b79b86adfb693cad3229fd246e08071b7ba101

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