MCPcopy
hub / github.com/encode/starlette / __call__

Method __call__

starlette/middleware/wsgi.py:100–114  ·  view source on GitHub ↗
(self, receive: Receive, send: Send)

Source from the content-addressed store, hash-verified

98 self.exc_info: Any = None
99
100 async def __call__(self, receive: Receive, send: Send) -> None:
101 body = b""
102 more_body = True
103 while more_body:
104 message = await receive()
105 body += message.get("body", b"")
106 more_body = message.get("more_body", False)
107 environ = build_environ(self.scope, body)
108
109 async with create_collapsing_task_group() as task_group:
110 task_group.start_soon(self.sender, send)
111 async with self.stream_send:
112 await anyio.to_thread.run_sync(self.wsgi, environ, self.start_response)
113 if self.exc_info is not None:
114 raise self.exc_info[0].with_traceback(self.exc_info[1], self.exc_info[2])
115
116 async def sender(self, send: Send) -> None:
117 async with self.stream_receive:

Callers

nothing calls this directly

Calls 4

build_environFunction · 0.85
receiveFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected