]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/unbound/libunbound/python/doc/examples/example7-2.py
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / unbound / libunbound / python / doc / examples / example7-2.py
1 #!/usr/bin/python
2 # vim:fileencoding=utf-8
3 #
4 # IDN (Internationalized Domain Name) lookup support (lookup for MX)
5 #
6 import unbound
7
8 ctx = unbound.ub_ctx()
9 ctx.resolvconf("/etc/resolv.conf")
10
11 status, result = ctx.resolve(u"háčkyčárky.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
12 if status == 0 and result.havedata:
13     print "Result:"
14     print "      raw data:", result.data
15     for k in result.data.mx_list_idn:
16         print "      priority:%d address:%s" % k