2. Who?
• Python enthusiast
• RWTH Aachen Master student
• Contributed into aiohttp, aiozmq, aioes, aiohttp-session
• Using asyncio in production for >1 year
28. aiozmq
import asyncio
from aiozmq import rpc
class Handler(rpc.AttrHandler):
@rpc.method
def remote(self, arg1, arg2):
return arg1 + arg2
29. aiozmq
@asyncio.coroutine
def go():
server = yield from rpc.serve_rpc(
Handler(),
bind='tcp://127.0.0.1:5555')
client = yield from rpc.connect_rpc(
connect='tcp://127.0.0.1:5555')
ret = yield from client.call.remote(1, 2)
assert ret == 3
30. PEP 492
async def read_data(db):
data = await db.fetch('SELECT ...')
...
async for row in Cursor():
print(row)
async with session.transaction():
...
await session.update(data)
...