O'Reilly logo

JUNOS Automation Cookbook by Adam Chappell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making REST API calls to Junos with Python

In this recipe, we'll use Python's built-in standard library routines for HTTPS in order to access the Junos OS REST API. We'll build an example app, rest.py, that allows a user to make simple RPC calls. In order to control the operation of the application, we'll define some command-line arguments.

Command line option

Description

-t xml | json | text

Specify the output format

-r rpc

Specify the actual RPC call

-c certificate

Self-signed certificate from router

-p port

HTTPS port number, default 8443

-u username

Username to authenticate with

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required