s4-python: import a copy of the python dns library
[idra/samba.git] / source4 / scripting / python / samba_external / dnspython / examples / name.py
diff --git a/source4/scripting/python/samba_external/dnspython/examples/name.py b/source4/scripting/python/samba_external/dnspython/examples/name.py
new file mode 100755 (executable)
index 0000000..b099c49
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+
+import dns.name
+
+n = dns.name.from_text('www.dnspython.org')
+o = dns.name.from_text('dnspython.org')
+print n.is_subdomain(o)         # True
+print n.is_superdomain(o)       # False
+print n > o                     # True
+rel = n.relativize(o)           # rel is the relative name www
+n2 = rel + o
+print n2 == n                   # True
+print n.labels                  # ['www', 'dnspython', 'org', '']