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.17.tar.gz (19.0 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.17-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cannon-0.0.17.tar.gz
  • Upload date:
  • Size: 19.0 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.17.tar.gz
Algorithm Hash digest
SHA256 a7065c39a8c6e72a7facc865b6bc210363a431865054e41e0461c66e1df38033
MD5 65232e4ebe3975b4e34dd7ea7947e698
BLAKE2b-256 a8731dbc8a65de49c07e95795c31352f4c0d45da6683cc159b1697aaf9951621

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cannon-0.0.17-py3-none-any.whl
  • Upload date:
  • Size: 7.7 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.17-py3-none-any.whl
Algorithm Hash digest
SHA256 67aa59a62f6ccc62cfa441c8ec36fc1f592e1cfa61634add731ace2b659a83e8
MD5 9c855bbbfe8e300f7198aa1ad9d1edd1
BLAKE2b-256 6d2e339f37c161ebe1ae0fd10d5ddb9a023d1ec01d0e355339277187d818be89

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