1#!/usr/bin/env python3
2
3import dns.query
4import dns.resolver
5import dns.zone
6
7soa_answer = dns.resolver.resolve('dnspython.org', 'SOA')
8master_answer = dns.resolver.resolve(soa_answer[0].mname, 'A')
9
10z = dns.zone.from_xfr(dns.query.xfr(master_answer[0].address, 'dnspython.org'))
11for n in sorted(z.nodes.keys()):
12    print(z[n].to_text(n))
13