diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/http-client.py | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/scripts/http-client.py b/scripts/http-client.py index ec311ffe..880ad039 100644 --- a/scripts/http-client.py +++ b/scripts/http-client.py @@ -1,10 +1,33 @@ # $Id$ -import rpki.config, rpki.https +""" +Usage: python http-client [ { -c | --config } configfile ] + [ { -h | --help } ] + [ { -m | --msg } message ] + +Default configuration file is http-demo.conf, override with --config option. +""" + +import rpki.config, rpki.https, getopt msg = "This is a test. This is only a test. Had this been real you would now be really confused.\n" -cfg = rpki.config.parser("http-demo.conf") +cfg_file = "http-demo.conf" + +opts,argv = getopt.getopt(sys.argv[1:], "c:hm:?", ["config=", "help", "msg="]) +for o,a in opts: + if o in ("-h", "--help", "-?"): + print __doc__ + sys.exit(0) + elif o in ("-m", "--msg"): + msg = a + elif o in ("-c", "--config"): + cfg_file = a +if argv: + print __doc__ + raise RuntimeError, "Unexpected arguments %s" % argv + +cfg = rpki.config.parser(cfg_file) section = "client" print rpki.https.client(privateKey = rpki.x509.RSA(Auto_file = cfg.get( section, "https-key")), |