summaryrefslogtreecommitdiffstats
path: root/ovh/soapi
diff options
context:
space:
mode:
Diffstat (limited to 'ovh/soapi')
-rwxr-xr-xovh/soapi/domainList20
-rwxr-xr-xovh/soapi/zoneEntryList6
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"