Created
September 22, 2014 19:27
-
-
Save dzen/c25e2a385a1b494f57cb 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 asyncio | |
import aiohttp.client | |
@asyncio.coroutine | |
def get_page(url): | |
return (yield from aiohttp.client.request('GET', url)) | |
def main(): | |
loop = asyncio.get_event_loop() | |
results = loop.run_until_complete(asyncio.gather( | |
get_page('http://localhost:8001'), | |
get_page('http://localhost:8002'), | |
get_page('http://localhost:8003'), | |
)) | |
print(results) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment