MCPcopy Index your code
hub / github.com/AstrBotDevs/AstrBot / bind_request_context

Function bind_request_context

astrbot/api/web.py:326–339  ·  view source on GitHub ↗

Bind a plugin Web request for the current async context. Args: request_: Request object exposed through the module-level request proxy. Yields: The bound request object.

(request_: PluginRequest)

Source from the content-addressed store, hash-verified

324
325@contextmanager
326def bind_request_context(request_: PluginRequest):
327 """Bind a plugin Web request for the current async context.
328
329 Args:
330 request_: Request object exposed through the module-level request proxy.
331
332 Yields:
333 The bound request object.
334 """
335 token = _request_var.set(request_)
336 try:
337 yield request_
338 finally:
339 _request_var.reset(token)
340
341
342def json_response(

Callers 1

_call_plugin_extensionFunction · 0.90

Calls 2

setMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected