MCPcopy
hub / github.com/encode/starlette / __init__

Method __init__

starlette/templating.py:32–44  ·  view source on GitHub ↗
(
        self,
        template: Any,
        context: dict[str, Any],
        status_code: int = 200,
        headers: Mapping[str, str] | None = None,
        media_type: str | None = None,
        background: BackgroundTask | None = None,
    )

Source from the content-addressed store, hash-verified

30
31class _TemplateResponse(HTMLResponse):
32 def __init__(
33 self,
34 template: Any,
35 context: dict[str, Any],
36 status_code: int = 200,
37 headers: Mapping[str, str] | None = None,
38 media_type: str | None = None,
39 background: BackgroundTask | None = None,
40 ):
41 self.template = template
42 self.context = context
43 content = template.render(context)
44 super().__init__(content, status_code, headers, media_type, background)
45
46 async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
47 request = self.context.get("request", {})

Callers

nothing calls this directly

Calls 2

renderMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected