Simple client library for working with Netpalm
Detailed example available in examples folder of this repo
pip install netpalm-client
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=}')
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.