[Twisted-Python] Problem with twisted.names.client.lookupPointer

Phil Mayers p.mayers at imperial.ac.uk
Sun Jul 19 07:17:40 EDT 2009


On Sun, Jul 19, 2009 at 06:34:21AM +0100, Kieran Simkin wrote:
>
>Nowhere in this output is the actual PTR record - the first entry looks like it should be the PTR record, but the name is '128.244.209.91.in-addr.arpa' - I'm expecting it to be node2.digital-crocus.com. Can anyone clarify whether I'm doing something wrong or if this is in fact a bug?
>

The name of the PTR record *is* a.b.c.d.in-addr.arpa. You want the 
*value*, which you can get from answer[0].payload.name. e.g.

def printPTR(results):
    answer, auth, additional = results
    if answer:
	print answer[0].payload.name

d = resolver.queryUDP([
	dns.Query('4.3.1.2.in-addr.arpa', dns.PTR)
    ])
d.addCallback(printPTR)

Obviously this code needs more error checking.



More information about the Twisted-Python mailing list