Create and return a request context. Use the :meth:`test_request_context` whilst testing. This is best used within a context, i.e. .. code-block:: python async with app.request_context(request): ... Arguments: request: A req
(self, request: Request)
| 1259 | return AppContext(self) |
| 1260 | |
| 1261 | def request_context(self, request: Request) -> RequestContext: |
| 1262 | """Create and return a request context. |
| 1263 | |
| 1264 | Use the :meth:`test_request_context` whilst testing. This is |
| 1265 | best used within a context, i.e. |
| 1266 | |
| 1267 | .. code-block:: python |
| 1268 | |
| 1269 | async with app.request_context(request): |
| 1270 | ... |
| 1271 | |
| 1272 | Arguments: |
| 1273 | request: A request to build a context around. |
| 1274 | """ |
| 1275 | return RequestContext(self, request) |
| 1276 | |
| 1277 | def websocket_context(self, websocket: Websocket) -> WebsocketContext: |
| 1278 | """Create and return a websocket context. |