Making Python's Asyncio Synchronous
Categories: python asyncio
Python 3.4 introduced asyncio — asynchronous I/O and coroutines which are very powerful tools for writing concurrent code in a sequential fashion. As these tools become more powerful, we are seeing more libraries and frameworks that depend on asyncio. More asyncio is a good thing; but, unfortunately many older frameworks such as Django and Flask don’t play nicely with coroutines. Here’s a snippet that will run your coroutine synchronously: # eventloop.