MCPcopy
hub / github.com/aio-libs/aiohttp / api_logging_middleware

Function api_logging_middleware

docs/code/client_middleware_cookbook.py:35–43  ·  view source on GitHub ↗
(
    req: ClientRequest, handler: ClientHandlerType
)

Source from the content-addressed store, hash-verified

33
34
35async def api_logging_middleware(
36 req: ClientRequest, handler: ClientHandlerType
37) -> ClientResponse:
38 # We use middlewares=() to avoid infinite recursion.
39 async with req.session.post("/log", data=req.url.host, middlewares=()) as resp:
40 if not resp.ok:
41 logging.warning("Log endpoint failed")
42
43 return await handler(req)
44
45
46class TokenRefresh401Middleware:

Callers

nothing calls this directly

Calls 2

handlerFunction · 0.50
postMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…