1 import DNS
2 import spf
3
4 if not hasattr(DNS.Type, 'SPF'):
5
6 DNS.Type.SPF = 99
7 DNS.Type.typemap[99] = 'SPF'
8 DNS.Lib.RRunpacker.getSPFdata = DNS.Lib.RRunpacker.getTXTdata
9
11 try:
12 req = DNS.DnsRequest(name, qtype=qtype)
13 resp = req.req()
14
15
16
17
18
19 return [((a['name'], a['typename']), a['data']) for a in resp.answers]
20 except IOError, x:
21 raise spf.TempError, 'DNS ' + str(x)
22 except DNS.DNSError, x:
23 raise spf.TempError, 'DNS ' + str(x)
24
25 DNS.DiscoverNameServers()
26
27 spf.DNSLookup = DNSLookup
28