Skip to content

routing

titiler.core.routing

Custom routing classes.

EndpointScope

Bases: TypedDict

Define endpoint.

add_route_dependencies

add_route_dependencies(
    routes: List[BaseRoute], *, scopes: List[EndpointScope], dependencies=List[params.Depends]
)

Add dependencies to routes.

Allows a developer to add dependencies to a route after the route has been defined.

apiroute_factory

apiroute_factory(env: Optional[Dict] = None) -> Type[APIRoute]

Create Custom API Route class with custom Env.

Because we cannot create middleware for specific router we need to create a custom APIRoute which add the rasterio.Env( block before the endpoint is actually called. This way we set the env outside the threads and we make sure that event multithreaded Reader will get the environment set.

Note: This has been tested in python 3.6 and 3.7 only.