From be257f3802d2d9da27805fb26504e439a3a497b3 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sun, 23 Dec 2007 06:50:37 +0000 Subject: Cleanup svn path=/scripts/http-client.py; revision=1428 --- scripts/http-client.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'scripts/http-client.py') 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")), -- cgit v1.2.3