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

How it works...

Step 1 is the usual boilerplate for any Python app. We import the necessary standard library routines. Important for this recipe is the httplib and ssl libraries which provide framework classes and methods for forming and comprehending HTTP requests and responses as well as the same over SSL/TLS.

In step 2, we use the argparse library to implement a simple scan of the command line. Our application has several runtime knobs, visible with the –h switch, and as the user selects each one, we need to influence the internal variables to affect our application appropriately.

In step 3, we prompt the user for a password that we store, in order to use it in the HTTP authorization header.

Unlike the recipes where we communicate using ...

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