diff options
Diffstat (limited to 'external/unbound/libunbound/python/examples')
9 files changed, 27 insertions, 18 deletions
diff --git a/external/unbound/libunbound/python/examples/async-lookup.py b/external/unbound/libunbound/python/examples/async-lookup.py index cbb8ea02d..936be3218 100644 --- a/external/unbound/libunbound/python/examples/async-lookup.py +++ b/external/unbound/libunbound/python/examples/async-lookup.py @@ -32,6 +32,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ''' +from __future__ import print_function import unbound import time @@ -39,9 +40,9 @@ ctx = unbound.ub_ctx() ctx.resolvconf("/etc/resolv.conf") def call_back(my_data,status,result): - print("Call_back:", my_data) + print("Call_back:", sorted(my_data)) if status == 0 and result.havedata: - print("Result:", result.data.address_list) + print("Result:", sorted(result.data.address_list)) my_data['done_flag'] = True diff --git a/external/unbound/libunbound/python/examples/dns-lookup.py b/external/unbound/libunbound/python/examples/dns-lookup.py index b3f4008fd..a175dfb0e 100644 --- a/external/unbound/libunbound/python/examples/dns-lookup.py +++ b/external/unbound/libunbound/python/examples/dns-lookup.py @@ -32,6 +32,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ''' +from __future__ import print_function import unbound ctx = unbound.ub_ctx() @@ -39,6 +40,6 @@ ctx.resolvconf("/etc/resolv.conf") status, result = ctx.resolve("www.nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN) if status == 0 and result.havedata: - print("Result:", result.data.address_list) + print("Result:", sorted(result.data.address_list)) elif status != 0: print("Error:", unbound.ub_strerror(status)) diff --git a/external/unbound/libunbound/python/examples/dnssec-valid.py b/external/unbound/libunbound/python/examples/dnssec-valid.py index 5c3cad9e9..386f4c277 100644 --- a/external/unbound/libunbound/python/examples/dnssec-valid.py +++ b/external/unbound/libunbound/python/examples/dnssec-valid.py @@ -32,6 +32,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ''' +from __future__ import print_function import os from unbound import ub_ctx,RR_TYPE_A,RR_CLASS_IN @@ -48,7 +49,7 @@ if os.path.isfile("keys"): status, result = ctx.resolve("www.nic.cz", RR_TYPE_A, RR_CLASS_IN) if status == 0 and result.havedata: - print("Result:", result.data.address_list) + print("Result:", sorted(result.data.address_list)) if result.secure: print("Result is secure") diff --git a/external/unbound/libunbound/python/examples/dnssec_test.py b/external/unbound/libunbound/python/examples/dnssec_test.py index 0d62b9ff2..430e51a80 100644 --- a/external/unbound/libunbound/python/examples/dnssec_test.py +++ b/external/unbound/libunbound/python/examples/dnssec_test.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +from __future__ import print_function from unbound import ub_ctx, RR_TYPE_A, RR_TYPE_RRSIG, RR_TYPE_NSEC, RR_TYPE_NSEC3 import ldns @@ -12,16 +13,16 @@ def dnssecParse(domain, rrType=RR_TYPE_A): raise RuntimeError("Error parsing DNS packet") rrsigs = pkt.rr_list_by_type(RR_TYPE_RRSIG, ldns.LDNS_SECTION_ANSWER) - print("RRSIGs from answer:", rrsigs) + print("RRSIGs from answer:", sorted(rrsigs)) rrsigs = pkt.rr_list_by_type(RR_TYPE_RRSIG, ldns.LDNS_SECTION_AUTHORITY) - print("RRSIGs from authority:", rrsigs) + print("RRSIGs from authority:", sorted(rrsigs)) nsecs = pkt.rr_list_by_type(RR_TYPE_NSEC, ldns.LDNS_SECTION_AUTHORITY) - print("NSECs:", nsecs) + print("NSECs:", sorted(nsecs)) nsec3s = pkt.rr_list_by_type(RR_TYPE_NSEC3, ldns.LDNS_SECTION_AUTHORITY) - print("NSEC3s:", nsec3s) + print("NSEC3s:", sorted(nsec3s)) print("---") diff --git a/external/unbound/libunbound/python/examples/example8-1.py b/external/unbound/libunbound/python/examples/example8-1.py index ca868e510..723c4060e 100644 --- a/external/unbound/libunbound/python/examples/example8-1.py +++ b/external/unbound/libunbound/python/examples/example8-1.py @@ -33,6 +33,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ''' +from __future__ import print_function import unbound ctx = unbound.ub_ctx() @@ -42,20 +43,20 @@ status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN) if status == 0 and result.havedata: print("Result:") print(" raw data:", result.data) - for k in result.data.mx_list: + for k in sorted(result.data.mx_list): print(" priority:%d address:%s" % k) status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN) if status == 0 and result.havedata: print("Result:") print(" raw data:", result.data) - for k in result.data.address_list: + for k in sorted(result.data.address_list): print(" address:%s" % k) status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_NS, unbound.RR_CLASS_IN) if status == 0 and result.havedata: print("Result:") print(" raw data:", result.data) - for k in result.data.domain_list: + for k in sorted(result.data.domain_list): print(" host: %s" % k) diff --git a/external/unbound/libunbound/python/examples/idn-lookup.py b/external/unbound/libunbound/python/examples/idn-lookup.py index 2170637d3..f28315067 100644 --- a/external/unbound/libunbound/python/examples/idn-lookup.py +++ b/external/unbound/libunbound/python/examples/idn-lookup.py @@ -33,6 +33,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ''' +from __future__ import print_function import unbound import locale @@ -45,18 +46,18 @@ status, result = ctx.resolve(u"www.háčkyčárky.cz", unbound.RR_TYPE_A, unboun if status == 0 and result.havedata: print("Result:") print(" raw data:", result.data) - for k in result.data.address_list: + for k in sorted(result.data.address_list): print(" address:%s" % k) status, result = ctx.resolve(u"háčkyčárky.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN) if status == 0 and result.havedata: print("Result:") print(" raw data:", result.data) - for k in result.data.mx_list_idn: + for k in sorted(result.data.mx_list_idn): print(" priority:%d address:%s" % k) status, result = ctx.resolve(unbound.reverse('217.31.204.66')+'.in-addr.arpa', unbound.RR_TYPE_PTR, unbound.RR_CLASS_IN) if status == 0 and result.havedata: print("Result.data:", result.data) - for k in result.data.domain_list_idn: + for k in sorted(result.data.domain_list_idn): print(" dname:%s" % k) diff --git a/external/unbound/libunbound/python/examples/mx-lookup.py b/external/unbound/libunbound/python/examples/mx-lookup.py index f83f690f8..e9394b355 100644 --- a/external/unbound/libunbound/python/examples/mx-lookup.py +++ b/external/unbound/libunbound/python/examples/mx-lookup.py @@ -33,6 +33,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ''' +from __future__ import print_function import unbound ctx = unbound.ub_ctx() @@ -42,12 +43,12 @@ status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN) if status == 0 and result.havedata: print("Result:") print(" raw data:", result.data) - for k in result.data.mx_list: + for k in sorted(result.data.mx_list): print(" priority:%d address:%s" % k) status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN) if status == 0 and result.havedata: print("Result:") print(" raw data:", result.data) - for k in result.data.address_list: + for k in sorted(result.data.address_list): print(" address:%s" % k) diff --git a/external/unbound/libunbound/python/examples/ns-lookup.py b/external/unbound/libunbound/python/examples/ns-lookup.py index bcd51de6d..49f567283 100644 --- a/external/unbound/libunbound/python/examples/ns-lookup.py +++ b/external/unbound/libunbound/python/examples/ns-lookup.py @@ -33,6 +33,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ''' +from __future__ import print_function import unbound ctx = unbound.ub_ctx() @@ -42,6 +43,6 @@ status, result = ctx.resolve("vutbr.cz", unbound.RR_TYPE_NS, unbound.RR_CLASS_IN if status == 0 and result.havedata: print("Result:") print(" raw data:", result.data) - for k in result.data.domain_list: + for k in sorted(result.data.domain_list): print(" host: %s" % k) diff --git a/external/unbound/libunbound/python/examples/reverse-lookup.py b/external/unbound/libunbound/python/examples/reverse-lookup.py index 7e06844ec..c9a13fea6 100644 --- a/external/unbound/libunbound/python/examples/reverse-lookup.py +++ b/external/unbound/libunbound/python/examples/reverse-lookup.py @@ -32,6 +32,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ''' +from __future__ import print_function import unbound ctx = unbound.ub_ctx() @@ -39,5 +40,5 @@ ctx.resolvconf("/etc/resolv.conf") status, result = ctx.resolve(unbound.reverse("74.125.43.147") + ".in-addr.arpa.", unbound.RR_TYPE_PTR, unbound.RR_CLASS_IN) if status == 0 and result.havedata: - print("Result.data:", result.data, result.data.domain_list) + print("Result.data:", result.data, sorted(result.data.domain_list)) |