Skip to content

Instantly share code, notes, and snippets.

@dzen
Created September 22, 2014 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dzen/c25e2a385a1b494f57cb to your computer and use it in GitHub Desktop.
Save dzen/c25e2a385a1b494f57cb to your computer and use it in GitHub Desktop.
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