Source code for luna_sender.app.handlers.base_handler
# -*- coding: utf-8 -*-
""" Base handler
Module realize base class for all handlers.
"""
from app.app import SenderApp, SenderRequest
from configs.configs.configs.services import SettingsSender
from crutches_on_wheels.web.handlers import BaseHandler
[docs]class BaseSenderRequestHandler(BaseHandler):
"""
Base handler for other handlers.
Attributes:
accountId: request account id
redisContext: redis context
"""
def __init__(self, request: SenderRequest):
super().__init__(request)
self.accountId = request.accountId
self.redisContext = request.app.ctx.redisContext
@property
def app(self) -> SenderApp:
"""
Get running app
Returns:
app
"""
return self.request.app
@property
def config(self) -> SettingsSender:
"""
Get app config
Returns:
app config
"""
return self.app.ctx.serviceConfig