summaryrefslogtreecommitdiff
path: root/contrib/ldnsx/examples/ldnsx-mx2.py
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ldnsx/examples/ldnsx-mx2.py')
-rw-r--r--contrib/ldnsx/examples/ldnsx-mx2.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/contrib/ldnsx/examples/ldnsx-mx2.py b/contrib/ldnsx/examples/ldnsx-mx2.py
new file mode 100644
index 0000000..8bee67f
--- /dev/null
+++ b/contrib/ldnsx/examples/ldnsx-mx2.py
@@ -0,0 +1,17 @@
+#!/usr/bin/python
+#
+# MX is a small program that prints out the mx records for a particular domain
+#
+import ldnsx
+
+resolver = ldnsx.resolver()
+
+pkt = resolver.query("nic.cz", "MX")
+if pkt:
+ for rr in pkt.answer(rr_type = "MX"):
+ rdf = rr.owner()
+ print rr
+ #Could also do:
+ #print rr[0], rr[1], rr[2], rr[3], " ".join(rr[4:])
+ #print rr.owner(), rr.ttl(), rr.rr_clas(), rr.rr_type(), " ".join(rr[4:])
+