当前位置: 首页>>代码示例>>Python>>正文


Python types.ASGIApp方法代码示例

本文整理汇总了Python中starlette.types.ASGIApp方法的典型用法代码示例。如果您正苦于以下问题:Python types.ASGIApp方法的具体用法?Python types.ASGIApp怎么用?Python types.ASGIApp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在starlette.types的用法示例。


在下文中一共展示了types.ASGIApp方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from starlette import types [as 别名]
# 或者: from starlette.types import ASGIApp [as 别名]
def __init__(
        self,
        routes: List[routing.BaseRoute] = None,
        redirect_slashes: bool = True,
        default: ASGIApp = None,
        dependency_overrides_provider: Any = None,
        route_class: Type[APIRoute] = APIRoute,
        default_response_class: Type[Response] = None,
        on_startup: Sequence[Callable] = None,
        on_shutdown: Sequence[Callable] = None,
    ) -> None:
        super().__init__(
            routes=routes,
            redirect_slashes=redirect_slashes,
            default=default,
            on_startup=on_startup,
            on_shutdown=on_shutdown,
        )
        self.dependency_overrides_provider = dependency_overrides_provider
        self.route_class = route_class
        self.default_response_class = default_response_class 
开发者ID:tiangolo,项目名称:fastapi,代码行数:23,代码来源:routing.py

示例2: __init__

# 需要导入模块: from starlette import types [as 别名]
# 或者: from starlette.types import ASGIApp [as 别名]
def __init__(
        self,
        app: ASGIApp,
        db_url: Optional[Union[str, URL]] = None,
        custom_engine: Optional[Engine] = None,
        engine_args: Dict = None,
        session_args: Dict = None,
    ):
        super().__init__(app)
        global _Session
        engine_args = engine_args or {}

        session_args = session_args or {}
        if not custom_engine and not db_url:
            raise ValueError("You need to pass a db_url or a custom_engine parameter.")
        if not custom_engine:
            engine = create_engine(db_url, **engine_args)
        else:
            engine = custom_engine
        _Session = sessionmaker(bind=engine, **session_args) 
开发者ID:mfreeborn,项目名称:fastapi-sqlalchemy,代码行数:22,代码来源:middleware.py

示例3: __init__

# 需要导入模块: from starlette import types [as 别名]
# 或者: from starlette.types import ASGIApp [as 别名]
def __init__(self, app: ASGIApp, filter_unhandled_paths: bool = False) -> None:
        super().__init__(app)
        self.filter_unhandled_paths = filter_unhandled_paths 
开发者ID:perdy,项目名称:starlette-prometheus,代码行数:5,代码来源:middleware.py

示例4: __init__

# 需要导入模块: from starlette import types [as 别名]
# 或者: from starlette.types import ASGIApp [as 别名]
def __init__(
        self,
        app: ASGIApp,
        callback_url: str = "https://localhost:8000/kc/callback",
        redirect_uri: str = "/",
        logout_uri: str = "/kc/logout",
    ) -> None:
        self.app = app
        self.callback_url = callback_url
        self.redirect_uri = redirect_uri
        self.logout_uri = logout_uri
        self.kc = Client(callback_url) 
开发者ID:chunky-monkeys,项目名称:keycloak-client,代码行数:14,代码来源:starlette.py

示例5: __init__

# 需要导入模块: from starlette import types [as 别名]
# 或者: from starlette.types import ASGIApp [as 别名]
def __init__(self, app: ASGIApp, client: Client):
        """

        Args:
            app (ASGIApp): Starlette app
            client (Client): ElasticAPM Client
        """
        self.client = client

        if self.client.config.instrument:
            elasticapm.instrumentation.control.instrument()

        super().__init__(app) 
开发者ID:elastic,项目名称:apm-agent-python,代码行数:15,代码来源:__init__.py

示例6: __init__

# 需要导入模块: from starlette import types [as 别名]
# 或者: from starlette.types import ASGIApp [as 别名]
def __init__(self, app: ASGIApp, config: GraphQLConfig):
        self.app = app
        self.config = config 
开发者ID:tartiflette,项目名称:tartiflette-asgi,代码行数:5,代码来源:_middleware.py


注:本文中的starlette.types.ASGIApp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。