[Twisted-Python] Twisted.Names assistance with auth and additional sections

Sean Leach kickdaddy at gmail.com
Tue Mar 20 19:13:14 EDT 2007

Thanks Jean-Paul,

I tried changing to queryUDP, and it just sits there, never sends out
a query (watching with tcpdump).  If I change it to _lookup, which it
looks like queryUDP calls, it sends the query, but like lookupAddress,
I don't get the additional and auth sections still...

What is weird, when I do this

deferred = resolver.queryUDP([Dns.Query(name, dns.IN, dns.A)])

and I try and debug why it's hanging, I put a print in the
ResolverBase.queryUDP function right at the top, and it never prints.


On 3/20/07, Jean-Paul Calderone <exarkun at divmod.com> wrote:
> On Tue, 20 Mar 2007 14:27:26 -0700, Sean Leach <kickdaddy at gmail.com> wrote:
> >Hey all,
> >
> >I have a client I have written using twisted.names that will send a
> >DNS request.  Here is the gist of the relevant code:
> >
> >    (tfp, tfile) = tempfile.mkstemp()
> >    os.write(tfp, 'nameserver %s' % ip)
> >    os.close(tfp)
> >    resolver = client.createResolver(resolvconf=tfile)
> >    deferred = resolver.lookupAddress(somevalue)
> >    deferred.addCallback(resultHandler)
> >
> >hacky way to set the IP, but I am having issues with passing in the
> >"servers" list I don't want to troubleshoot until I figure out this
> >problem.
> >
> >Anyways, as you can see, this code calls the lookupAddress method for
> >the name I want.  The problem I am having is it is only returning the
> >answer section of the response.  I need the additional and authority
> >sections as well (and I know for sure those sections exist in the
> >response).  I have looked at the docs and the code, and I don't know
> >what I am missing.  I am sure it's something silly, but I am missing
> >it right now.
> >
> >So long question short, what do I need to change in my code so I can
> >get the additional sections and authority sections in the response so
> >I can get to those values?
> One approach would be to use queryUDP directly instead of lookupAddress:
>     resolver.queryUDP([dns.Query(name, dns.A, dns.IN)])
> Which will give you a full message object back, including lists of answers,
> additional, and authority sections.
> Jean-Paul
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

More information about the Twisted-Python mailing list