diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2012-07-04 14:22:28 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2012-07-04 14:22:28 +0000 |
commit | a1ba2d1ca3a1d6c9c36a79a196dd3ccb83ede353 (patch) | |
tree | ae20718827f0ca6f869c0f7bdb777816d3bf5f3a /contrib/python/examples/python3/ldns-mx.py |
Notes
Diffstat (limited to 'contrib/python/examples/python3/ldns-mx.py')
-rwxr-xr-x | contrib/python/examples/python3/ldns-mx.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/contrib/python/examples/python3/ldns-mx.py b/contrib/python/examples/python3/ldns-mx.py new file mode 100755 index 000000000000..1d2ba03669cc --- /dev/null +++ b/contrib/python/examples/python3/ldns-mx.py @@ -0,0 +1,15 @@ +#!/usr/bin/python +# +# MX is a small program that prints out the mx records for a particular domain +# +import ldns + +resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") + +pkt = resolver.query("nic.cz", ldns.LDNS_RR_TYPE_MX,ldns.LDNS_RR_CLASS_IN) + +if (pkt): + mx = pkt.rr_list_by_type(ldns.LDNS_RR_TYPE_MX, ldns.LDNS_SECTION_ANSWER) + if (mx): + mx.sort() + print(mx) |