summaryrefslogtreecommitdiffstats
path: root/ovh/soapi/domainList
diff options
context:
space:
mode:
authortv <tv@xso>2011-08-22 15:28:34 +0200
committertv <tv@xso>2011-08-22 15:28:34 +0200
commit4186e40734ae9cf8ab20437b70d09eeae23399c4 (patch)
tree4ac764979979ab28a76d61737f3f66d2090f7824 /ovh/soapi/domainList
parenta002b665583bad738e47bef6f93f87d6ab74bfda (diff)
ovh soapi *List: unify [JSON-] output
Diffstat (limited to 'ovh/soapi/domainList')
-rwxr-xr-xovh/soapi/domainList20
1 files changed, 11 insertions, 9 deletions
diff --git a/ovh/soapi/domainList b/ovh/soapi/domainList
index 3f829ebe..b089f6a4 100755
--- a/ovh/soapi/domainList
+++ b/ovh/soapi/domainList
@@ -1,24 +1,26 @@
#!/usr/bin/python
from os import environ
-import pprint
from SOAPpy import WSDL
+from json import dumps, JSONEncoder
+
+def default(o):
+ try:
+ iterable = iter(o)
+ except TypeError:
+ pass
+ else:
+ return list(iterable)
+ return JSONEncoder.default(o)
soap = WSDL.Proxy('https://www.ovh.com/soapi/soapi-re-1.24.wsdl')
username = environ['KREBS_OVH_USER']
password = environ['KREBS_OVH_PASS']
-#login
session = soap.login(username, password, 'de', 0)
-print "login successfull"
-#domainHostList
result = soap.domainList(session)
-print "domainList successfull"
-pp = pprint.PrettyPrinter(indent=4)
-pp.pprint(result) # your code here ...
+print dumps(result, sort_keys=True, indent=2, default=default)
-#logout
soap.logout(session)
-print "logout successfull"