當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。