async def add_pet(self, request): data = await request.json() pet = Pet(**data) pet.save_to_db() return web.Response(status=201, body=json.dumps(pet.json()).encode('utf-8'), content_type='application/json')