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.22.tar.gz (20.6 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.22-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cannon-0.0.22.tar.gz
  • Upload date:
  • Size: 20.6 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.22.tar.gz
Algorithm Hash digest
SHA256 ad7f858b38b4bc9cf5ccec87706f7756593874efc8fd443cbe8b85e8ad89636e
MD5 4249eac6cd26e18899eafb59517498b3
BLAKE2b-256 dbe50502d33d87127d0c7264e4ca6fa5cc4dec7329be0a47c1038df093d0ca5f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cannon-0.0.22-py3-none-any.whl
  • Upload date:
  • Size: 8.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.22-py3-none-any.whl
Algorithm Hash digest
SHA256 443aa370087cebff5e5516ef184412b20bc7697a5fd5bdc567fcf93963882885
MD5 4cde1367d3a6e4ad32b6e2a5d23861db
BLAKE2b-256 4ecec7d0a57332ec60fc7daf5d311aa1154d60f33e8e53896f3af65e448eb212

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