Commits

William Pitcock committed 2247154

edia-domainlist example: improve documentation

Comments (0)

Files changed (1)

examples/edia-domainlist.py

+#!/usr/bin/env python
+#
+# A proof of concept script which calls the 'domain_list' method published on
+# an RPC server.  This method in theory returns a dictionary of the format:
+#
+# {'domain-name': {'key': 'value', 'key2': 'value2'}}
+#
+# So we extract the key in the top-level dictionary and print it.
+#
+
 from ediarpc import rpc_client
-from pprint import pprint
-cli = rpc_client.ServerProxy('142.4.218.16', 5959, 'moocows'.encode('ascii'), True, iterations=15)
 
-print "Calling domain_list() RPC on bhs0"
+if len(sys.argv) < 3:
+    print "usage: %s hostname secret" % sys.argv[0]
+    exit()
+
+hostname = sys.argv[1]
+secret = sys.argv[2].encode('ascii')
+
+cli = rpc_client.ServerProxy(hostname, 5959, secret, True, iterations=15)
+
 list = cli.domain_list()
 
 for domain, stats in list.items():