8000 incompatible type and expected "type[_MiddlewareClass[[]]]" [arg-type] · Issue #2912 · encode/starlette · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
incompatible type and expected "type[_MiddlewareClass[[]]]" [arg-type] #2912
Open
@RaviMintel07

Description

@RaviMintel07

Hi ,

am using asgi-logger and extended AccessLoggerMiddleware to customise the logging in the application and when I upgrade fastapi to 0.109.x version getting issue on mypy, any suggestions ?

error: Argument 1 to "Middleware" has incompatible type "type[AccessLoggerMiddleware]"; expected "type[_MiddlewareClass[[]]]" [arg-type]

middleware = [
    Middleware(
        CORSMiddleware,
        allow_origins=["*"],
        allow_methods=["PUT", "GET", "DELETE"],
        allow_headers=["Authorization"],
    ),
    Middleware(access_logger.AccessLoggerMiddleware),
]

and this is my customise version of logging.

import structlog
from asgi_logger import middleware as asl
from asgiref.typing import ASGI3Application, HTTPScope


class AccessLoggerMiddleware(asl.AccessLoggerMiddleware):
   //code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0