Created
February 17, 2015 02:52
-
-
Save jamielennox/4e22049c5bc57f4b68ec to your computer and use it in GitHub Desktop.
Load an auth plugin and session from options on the command line.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import sys | |
from keystoneclient import auth | |
from keystoneclient import session | |
parser = argparse.ArgumentParser('myapp') | |
auth.register_argparse_arguments(parser, sys.argv[1:]) | |
session.Session.register_cli_options(parser) | |
args = parser.parse_args() | |
plugin = auth.load_from_argparse_arguments(args) | |
sess = session.Session.load_from_cli_options(args, auth=plugin) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment