Created
October 13, 2012 21:01
-
-
Save oubiwann/3886139 to your computer and use it in GitHub Desktop.
Async Batching with Twisted: A Walkthrough
This file contains hidden or 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 twisted.internet import reactor | |
from twisted.web.client import getPage | |
from twisted.internet.defer import DeferredList | |
def listCallback(results): | |
print results | |
def finish(ign): | |
reactor.stop() | |
def test(): | |
d1 = getPage('http://www.google.com') | |
d2 = getPage('http://yahoo.com') | |
dl = DeferredList([d1, d2]) | |
dl.addCallback(listCallback) | |
dl.addCallback(finish) | |
test() | |
reactor.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment