This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 31st, 2010  |  syntax: Python  |  size: 0.39 KB  |  views: 38  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2.  
  3. from twisted.internet import defer, reactor
  4. from twisted.python.failure import Failure
  5. import twisted.names.client
  6.  
  7. def do_lookup(do_lookup):
  8.     d = twisted.names.client.getHostByName(domain)
  9.     d.addBoth(lookup_done)
  10.  
  11. def lookup_done(result):
  12.     print 'result:', result
  13.     reactor.stop()
  14.  
  15. domain = 'twistedmatrix.com'    
  16. reactor.callLater(0, do_lookup, domain)
  17. reactor.run()
clone this paste RAW Paste Data