Ticket #3712: root.patch

File root.patch, 718 bytes (added by cary, 8 years ago)
  • root.py

     
    194194    d = defer.DeferredList(L)
    195195    d.addCallback(lambda r: Resolver([e[1] for e in r if e[0]]))
    196196    return DeferredResolver(d)
    197 
    198 if __name__ == '__main__':
    199     if len(sys.argv) < 2:
    200         print 'Specify a domain'
    201     else:
    202         log.startLogging(sys.stdout)
    203         from twisted.names.client import ThreadedResolver
    204         r = bootstrap(ThreadedResolver())
    205         d = r.lookupAddress(sys.argv[1])
    206         d.addCallbacks(log.msg, log.err).addBoth(lambda _: reactor.stop())
    207         from twisted.internet import reactor
    208         reactor.run()