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

Jean-Paul Calderone exarkun at divmod.com
Wed Mar 21 07:36:41 MDT 2007


On Wed, 21 Mar 2007 05:31:08 -0700, Sean Leach <kickdaddy at gmail.com> wrote:
>Yes - I know, this was a small example program to show the problem I
>was seeing.  And I have read over all of the documentation, including
>the Twisted.names source.
>

The example I gave might have been a bit confusing.  I was using a shell
that has the reactor running already, so I didn't need to start it.  The
equivalent as a normal Twisted program would be something like:

  #!/usr/bin/python2.4
  import time
  from twisted.names import dns, client, _version
  from twisted.internet import reactor
  def errorHandler(error):
      print str(error)
  def gotMessage(message):
      print message.answers
      print message.additional
      print message.authority
  r = client.Resolver(servers=[('198.41.0.4', 53)])
  d = r.queryUDP([
      dns.Query('google.com', dns.IN, dns.A)])
  d.addErrback(errorHandler)
  d.addCallback(gotMessage)
  reactor.run()

Jean-Paul




More information about the Twisted-Python mailing list