INNER CODE UNIT · Python

_import_iter_route_contexts

stephenhillier/starlette_exporter · starlette_exporter/middleware.py:34

def _import_iter_route_contexts() -> Optional[
    Callable[[Sequence[BaseRoute]], Iterator[Any]]
]:
    """Import FastAPI's route-flattening helper, if available.
    """
    try:
        from fastapi.routing import iter_route_contexts
    except ImportError:
        return None
    return iter_route_contexts


iter_route_contexts = _import_iter_route_contexts()

logger = logging.getLogger("starlette_exporter")


def _matchable_route(route: Any) -> BaseRoute:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…