Move dnspython to third_party.
[bbaumbach/samba-autobuild/.git] / third_party / dnspython / examples / xfr.py
1 #!/usr/bin/env python
2
3 import dns.query
4 import dns.resolver
5 import dns.zone
6
7 soa_answer = dns.resolver.query('dnspython.org', 'SOA')
8 master_answer = dns.resolver.query(soa_answer[0].mname, 'A')
9
10 z = dns.zone.from_xfr(dns.query.xfr(master_answer[0].address, 'dnspython.org'))
11 names = z.nodes.keys()
12 names.sort()
13 for n in names:
14         print z[n].to_text(n)