aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2007-12-23 06:50:37 +0000
committerRob Austein <sra@hactrn.net>2007-12-23 06:50:37 +0000
commitbe257f3802d2d9da27805fb26504e439a3a497b3 (patch)
treeb21d05f6fcc5f366b2d11acc578f86600c0b5788 /scripts
parent6a3b2581d5b97d5ea6207ad0c6a57c55576dafc8 (diff)
Cleanup
svn path=/scripts/http-client.py; revision=1428
Diffstat (limited to 'scripts')
-rw-r--r--scripts/http-client.py27
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")),