Skip to content

Instantly share code, notes, and snippets.

@exarkun
Forked from jevinskie/gist:955631
Created May 4, 2011 17:42
Show Gist options
  • Save exarkun/955638 to your computer and use it in GitHub Desktop.
Save exarkun/955638 to your computer and use it in GitHub Desktop.
from threading import Thread
from twisted.internet import reactor
from twisted.internet.threads import blockingCallFromThread
from twisted.names import client
running = False
def query():
global running
if not running:
running = True
Thread(target=reactor.run, args=(False,)).start()
return blockingCallFromThread(reactor, client.lookupAddress, 'google.com')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment