[Twisted-Python] Twisted.Names assistance with auth and additional sections
Thomas Hervé
therve at free.fr
Wed Mar 21 03:11:51 MDT 2007
Quoting Sean Leach <kickdaddy at gmail.com>:
> Ok...ignore my last post, jumped the gun, the additional and authority
> still don't exist in the result object. In addition, I tried your
> example to make sure I wasn't crazy, and it doesn't return any result
> data. I know it's not a network issue or anything silly as I can
> query a.root fine with dig and get the results. Here is the session:
>
> $ cat test.py
> #!/usr/bin/python2.4
> import time
> from twisted.names import dns, client, _version
> print _version.version
> def errorHandler(error):
> print str(error)
> r = client.Resolver(servers=[('198.41.0.4', 53)])
> d = r.queryUDP([dns.Query('google.com', dns.IN,
> dns.A)]).addErrback(errorHandler)
> time.sleep(5) ## give it a time for shitz and giggles
> print d
> print d.result
I *think* you're missing something about Twisted. You should start the reactor
to have something, and *never* use time.sleep inside a Twisted program.
You could start with reading the documentation here:
http://twistedmatrix.com/projects/core/documentation/howto/async.html.
--
Thomas
More information about the Twisted-Python
mailing list