From 846d579ca352014ba10f9b51ba66672cfcb90540 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 22 Aug 2011 14:58:14 +0200 Subject: ovh soapi zoneEntryList: initial commit --- ovh/soapi/zoneEntryList | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 ovh/soapi/zoneEntryList (limited to 'ovh/soapi/zoneEntryList') diff --git a/ovh/soapi/zoneEntryList b/ovh/soapi/zoneEntryList new file mode 100755 index 00000000..7c032462 --- /dev/null +++ b/ovh/soapi/zoneEntryList @@ -0,0 +1,24 @@ +#!/usr/bin/python + +from os import environ +import pprint +from SOAPpy import WSDL + +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" +pp = pprint.PrettyPrinter(indent=4) +pp.pprint(result) # your code here ... + +#logout +soap.logout(session) +print "logout successfull" -- cgit v1.2.3 From c0788cf40e57f8ef0f12821239373914e243f879 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 22 Aug 2011 15:20:28 +0200 Subject: ovh soapi zoneEntryList: initial commit --- ovh/soapi/zoneEntryList | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'ovh/soapi/zoneEntryList') diff --git a/ovh/soapi/zoneEntryList b/ovh/soapi/zoneEntryList index 7c032462..eb9c9c09 100755 --- a/ovh/soapi/zoneEntryList +++ b/ovh/soapi/zoneEntryList @@ -1,8 +1,17 @@ #!/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') @@ -16,8 +25,7 @@ print "login successfull" #zoneEntryList result = soap.zoneEntryList(session, 'krebsco.de') print "zoneEntryList 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) -- cgit v1.2.3 From 4186e40734ae9cf8ab20437b70d09eeae23399c4 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 22 Aug 2011 15:28:34 +0200 Subject: ovh soapi *List: unify [JSON-] output --- ovh/soapi/zoneEntryList | 6 ------ 1 file changed, 6 deletions(-) (limited to 'ovh/soapi/zoneEntryList') 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" -- cgit v1.2.3 From ee2d8ddd94e097106e8ebabd906afc82e4e7c63c Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 22 Aug 2011 16:06:13 +0200 Subject: ovh soapi *: use local wsdl copy --- ovh/soapi/zoneEntryList | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ovh/soapi/zoneEntryList') diff --git a/ovh/soapi/zoneEntryList b/ovh/soapi/zoneEntryList index 00f56958..af37c112 100755 --- a/ovh/soapi/zoneEntryList +++ b/ovh/soapi/zoneEntryList @@ -1,6 +1,7 @@ #!/usr/bin/python from os import environ +from os.path import dirname, realpath from SOAPpy import WSDL from json import dumps, JSONEncoder @@ -13,7 +14,8 @@ def default(o): return list(iterable) return JSONEncoder.default(o) -soap = WSDL.Proxy('https://www.ovh.com/soapi/soapi-re-1.24.wsdl') +wsdl = dirname(realpath(__file__)) + '/soapi-re-1.24.wsdl' +soap = WSDL.Proxy(wsdl) username = environ['KREBS_OVH_USER'] password = environ['KREBS_OVH_PASS'] -- cgit v1.2.3