diff options
author | tv <tv@xso> | 2011-08-22 15:28:34 +0200 |
---|---|---|
committer | tv <tv@xso> | 2011-08-22 15:28:34 +0200 |
commit | e036c795201a3eea50ec6d966ef4118c173f5189 (patch) | |
tree | a03d1b0a2c76a3f27926baddb04083c4ef5bffed | |
parent | eabf3eb5f15a57d560e74b94e0c0921377af0ea9 (diff) |
ovh soapi *List: unify [JSON-] output
-rwxr-xr-x | ovh/soapi/domainList | 20 | ||||
-rwxr-xr-x | ovh/soapi/zoneEntryList | 6 |
2 files changed, 11 insertions, 15 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" diff --git a/ovh/soapi/zoneEntryList b/ovh/soapi/zoneEntryList index eb9c9c09..00f56958 100755 --- a/ovh/soapi/zoneEntryList +++ b/ovh/soapi/zoneEntryList @@ -18,15 +18,9 @@ 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" -#zoneEntryList result = soap.zoneEntryList(session, 'krebsco.de') -print "zoneEntryList successfull" print dumps(result, sort_keys=True, indent=2, default=default) -#logout soap.logout(session) -print "logout successfull" |