copy_current_request_context
Decorate a function to run inside the current request context. This can be used when starting a background task, otherwise it will not see the app and request objects that were active in the parent.
def copy_current_request_context(
f: F
) - > F
Decorate a function to run inside the current request context. This can be used when starting a background task, otherwise it will not see the app and request objects that were active in the parent.
Parameters
| Name | Type | Description |
|---|---|---|
| f | F | The function to be decorated, typically a background task or callback that requires access to Flask's request or session objects. |
Returns
| Type | Description |
|---|---|
F | A wrapped version of the input function that automatically pushes the captured request context before execution. |