stream_with_context
Wrap a response generator function so that it runs inside the current request context. This keeps :data:.request, :data:.session, and :data:.g available, even though at the point the generator runs the request context will typically have ended.
def stream_with_context(
generator_or_function: t.Iterator[t.AnyStr] | t.Callable[..., t.Iterator[t.AnyStr]]
) - > t.Iterator[t.AnyStr] | t.Callable[[t.Iterator[t.AnyStr]], t.Iterator[t.AnyStr]]
Wrap a response generator function so that it runs inside the current request context. This keeps :data:.request, :data:.session, and :data:.g available, even though at the point the generator runs the request context will typically have ended.
Parameters
| Name | Type | Description |
|---|---|---|
| generator_or_function | `t.Iterator[t.AnyStr] | t.Callable[..., t.Iterator[t.AnyStr]]` |
Returns
| Type | Description |
|---|---|
| `t.Iterator[t.AnyStr] | t.Callable[[t.Iterator[t.AnyStr]], t.Iterator[t.AnyStr]]` |