INNER CODE UNIT · Python

__init__

leonh/redis-streams-fastapi-chat · chat.py:35

    def __init__(self, app, header_value='Example'):
        print('__init__')
        super().__init__(app)
        self.header_value = header_value

    async def dispatch(self, request, call_next):
        response = await call_next(request)
        response.headers['Custom'] = self.header_value
        return response


asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())

@asynccontextmanager
async def lifespan(app: FastAPI):
    # Startup
    try:
        redis_url = f"redis://{REDIS_HOST}:{REDIS_PORT}"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…