Created
September 7, 2012 16:43
-
-
Save JakeAustwick/3667669 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
>>> import gevent | |
>>> from gevent import socket | |
>>> urls = ['www.google.com', 'www.example.com', 'www.python.org'] | |
>>> jobs = [gevent.spawn(socket.gethostbyname, url) for url in urls] | |
>>> gevent.joinall(jobs, timeout=2) | |
>>> [job.value for job in jobs] | |
['74.125.79.106', '208.77.188.166', '82.94.164.162'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment