Skip to main content

Simple Client for accessing a Netpalm Service

Project description

Netpalm-Client

Simple client library for working with Netpalm

Detailed example available in examples folder of this repo

Install

pip install netpalm-client

Basic Usage

from netpalm_client import NetpalmClient

netpalm = NetpalmClient(
    url='https://netpalm.example.org',
    key='someApiKey',
    cli_user='cisco',
    cli_pass='cisco'
)

task_id = netpalm.netmiko_getconfig(
    command='show run | i bgp router-id',
    host='192.168.0.1'
)['task_id']

netpalm_result = netpalm.poll_task(task_id)  # blocks until polling returns either completion or failure

actual_result = netpalm_result['task_result'][command]  # failures will have a 'task_errors' key, but not a 'task_result' key.

print(f'{actual_result=}')

Changelog

1.0.0 - 1.0.3: Initial submissions

1.0.4: Fix #3: Don't use Walrus operator in code targeting python version 3.7.

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

netpalm-client-1.0.4.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

netpalm_client-1.0.4-py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 3

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