1*3b6c3722Schristos#!/usr/bin/python 2*3b6c3722Schristos# vim:fileencoding=utf-8 3*3b6c3722Schristos# 4*3b6c3722Schristos# IDN (Internationalized Domain Name) lookup support 5*3b6c3722Schristos# 6*3b6c3722Schristosimport unbound 7*3b6c3722Schristos 8*3b6c3722Schristosctx = unbound.ub_ctx() 9*3b6c3722Schristosctx.resolvconf("/etc/resolv.conf") 10*3b6c3722Schristos 11*3b6c3722Schristosstatus, result = ctx.resolve(u"www.háčkyčárky.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN) 12*3b6c3722Schristosif status == 0 and result.havedata: 13*3b6c3722Schristos print "Result:" 14*3b6c3722Schristos print " raw data:", result.data 15*3b6c3722Schristos for k in result.data.address_list: 16*3b6c3722Schristos print " address:%s" % k 17*3b6c3722Schristos 18