example7-2.py revision 238106
1238106Sdes#!/usr/bin/python 2238106Sdes# vim:fileencoding=utf-8 3238106Sdes# 4238106Sdes# IDN (Internationalized Domain Name) lookup support (lookup for MX) 5238106Sdes# 6238106Sdesimport unbound 7238106Sdes 8238106Sdesctx = unbound.ub_ctx() 9238106Sdesctx.resolvconf("/etc/resolv.conf") 10238106Sdes 11238106Sdesstatus, result = ctx.resolve(u"h����ky����rky.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN) 12238106Sdesif status == 0 and result.havedata: 13238106Sdes print "Result:" 14238106Sdes print " raw data:", result.data 15238106Sdes for k in result.data.mx_list_idn: 16238106Sdes print " priority:%d address:%s" % k 17