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

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.2.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: nw-ssh-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 9fa1557a25e464353c8e6b7ce098d9414c5b343e8a1b1ac13eed4aaf66738951
MD5 99097f4618dd8784de5ac44fe5734f5e
BLAKE2b-256 bc121895918cd463e155e2da0b41e3eaae21be2dd56d6c5746943aab06aee730

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nw_ssh-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 525b64968384f47ae602859e8d9b7264e2b913cc257c7797c91b7fd0d80e7906
MD5 0da11c46e0164206589f0c259d151124
BLAKE2b-256 41f0591052baab2185786eb8ffac6a4b52191155394fd4488478b22e0cea49f8

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