MCPcopy Create free account
hub / github.com/pallets/quart / stream_template_string

Function stream_template_string

src/quart/templating.py:118–130  ·  view source on GitHub ↗

Render a template from the given source with the *context* as a stream. This returns an iterator of strings, which can be used as a streaming response from a view. Arguments: source: The source code of the template to render. context: The variables to make available in

(source: str, **context: Any)

Source from the content-addressed store, hash-verified

116
117
118async def stream_template_string(source: str, **context: Any) -> AsyncIterator[str]:
119 """Render a template from the given source with the *context* as a stream.
120
121 This returns an iterator of strings, which can
122 be used as a streaming response from a view.
123
124 Arguments:
125 source: The source code of the template to render.
126 context: The variables to make available in the template.
127 """
128 await current_app.update_template_context(context)
129 template = current_app.jinja_env.from_string(source)
130 return await _stream(current_app._get_current_object(), template, context) # type: ignore
131
132
133async def _stream(

Callers 2

indexFunction · 0.90
index2Function · 0.90

Calls 2

_streamFunction · 0.85

Tested by 2

indexFunction · 0.72
index2Function · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…