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.14.tar.gz (18.9 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.14-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cannon-0.0.14.tar.gz
  • Upload date:
  • Size: 18.9 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.14.tar.gz
Algorithm Hash digest
SHA256 68bdcbb45d6e245d1df01256ef0430df640626fbf56a97774892b6d4f21095f8
MD5 f6dcba05837d418d1d49a39110c42d6e
BLAKE2b-256 a868fb0375425df4a82d3e8dd6cfa0e74928b6ae896a9ff42ed33656294c0009

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cannon-0.0.14-py3-none-any.whl
  • Upload date:
  • Size: 7.6 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.14-py3-none-any.whl
Algorithm Hash digest
SHA256 d8d761ccfd2d8242df2e43f6f7f5679f8521df76cf3e853cfa2b66e918d75257
MD5 988897c4492ef2204a5f1f6b3b1c62e8
BLAKE2b-256 75c0287087c9b8bbfdcbf50d2f134de883974a8a4f2f34357c81712c8de02492

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