Skip to main content

cannon

Project description

Introduction

cannon is a wrapper around pexpect to connect with remote server or network devices with ssh.

Example Usage

from cannon import Shell, Account

sess = Shell(
    host='route-views.oregon-ix.net',
    credentials=(
        Account(user='rviews', passwd=''),
    ),

    log_screen=False,
    log_file="~/mylog.txt",
    auto_priv_mode=False,
    debug=False,
    )

sess.execute('term len 0')
sess.sync_prompt() # Manually sync prompts... sometimes this is reqd

# template is a TextFSM template
values = sess.execute('show ip int brief',
    template="""Value INTF (\S+)\nValue IPADDR (\S+)\nValue STATUS (up|down|administratively down)\nValue PROTO (up|down)\n\nStart\n  ^${INTF}\s+${IPADDR}\s+\w+\s+\w+\s+${STATUS}\s+${PROTO} -> Record""")
print("VALUES "+str(values))
sess.close()

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

cannon-0.0.18.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cannon-0.0.18-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file cannon-0.0.18.tar.gz.

File metadata

  • Download URL: cannon-0.0.18.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.3.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.0

File hashes

Hashes for cannon-0.0.18.tar.gz
Algorithm Hash digest
SHA256 570b7ea6b4daa34d89b76d0830d25ab5e26512da61ac4570756073d412c64c1c
MD5 4eae89447a14b0907f76a9b2efc492e1
BLAKE2b-256 b6dfd1cf4d75cbe2e53b27072ba3960567d19ee3457dffff44d488a2831d36b3

See more details on using hashes here.

File details

Details for the file cannon-0.0.18-py3-none-any.whl.

File metadata

  • Download URL: cannon-0.0.18-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.3.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.0

File hashes

Hashes for cannon-0.0.18-py3-none-any.whl
Algorithm Hash digest
SHA256 0e898abe8d167bbf2d80ffa3f277d3f752dcf7cc27ed9b304d3b30de92103e2e
MD5 30ee451b4ff5ec0f007f4bb99a19bb21
BLAKE2b-256 0e93c3f7da9bfc921d81af77b83cb458f39adcd11d8094526227e7d11d1a06af

See more details on using hashes here.

Supported by

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