I have recently started writing a server for some obscure protocol using Python’s new asyncio module.
The module works great for writing the server, but any external IO the server has to do is tricky. There are simply not so many libraries, and asyncio doesn’t do patching the way gevent does.
The quick and dirty solution is to use run_in_executor
to run blocking code in a thread.
The only other game in town for HTTP is aiohttp, which is relatively young and occasionally buggy.
Then I found that Tornado has support for running on the asyncio event loop. Tornado includes a much more mature HTTP client that can optionally use libcurl.
The Tornado HTTP client returns a Future that is similar but not compatible with Futures from asyncio. So in order to use Tornado in a asyncio coroutine, a little wrapper is needed.