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.