I use aiohttp . at what places of app do I need to type await ? as I know there are cases:
when code is about session
async def get(self): session = await get_session(self.request)
when code is about database
def __init__(self, db, **kwargs):
self.collection = db[MESSAGE_COLLECTION]
async def save(self, user, msg, **kw):
result = await self.collection.insert({'user': user, 'msg': msg, 'time': datetime.now()})
- when code is about sockets
async def get(self):
ws = web.WebSocketResponse()
await ws.prepare(self.request)