Python starlette.types.ASGIApp() Examples
The following are 6
code examples of starlette.types.ASGIApp().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
starlette.types
, or try the search function
.
Example #1
Source File: routing.py From fastapi with MIT License | 6 votes |
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
Example #2
Source File: middleware.py From fastapi-sqlalchemy with MIT License | 6 votes |
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)
Example #3
Source File: middleware.py From starlette-prometheus with GNU General Public License v3.0 | 5 votes |
def __init__(self, app: ASGIApp, filter_unhandled_paths: bool = False) -> None: super().__init__(app) self.filter_unhandled_paths = filter_unhandled_paths
Example #4
Source File: starlette.py From keycloak-client with GNU General Public License v3.0 | 5 votes |
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)
Example #5
Source File: __init__.py From apm-agent-python with BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example #6
Source File: _middleware.py From tartiflette-asgi with MIT License | 5 votes |
def __init__(self, app: ASGIApp, config: GraphQLConfig): self.app = app self.config = config