File: example7-2.py

package info (click to toggle)
unbound 1.24.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 31,436 kB
  • sloc: ansic: 138,476; sh: 6,860; yacc: 4,259; python: 1,950; makefile: 1,881; awk: 162; perl: 158; xml: 36
file content (16 lines) | stat: -rw-r--r-- 467 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/python
# vim:fileencoding=utf-8
#
# IDN (Internationalized Domain Name) lookup support (lookup for MX)
#
import unbound

ctx = unbound.ub_ctx()
ctx.resolvconf("/etc/resolv.conf")

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:
        print "      priority:%d address:%s" % k