-
-
Save exarkun/955638 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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