MCPcopy Index your code
hub / github.com/python-websockets/websockets / parse

Method parse

src/websockets/server.py:544–567  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

542 next(self.parser) # start coroutine
543
544 def parse(self) -> Generator[None]:
545 if self.state is CONNECTING:
546 try:
547 request = yield from Request.parse(
548 self.reader.read_line,
549 )
550 except Exception as exc:
551 self.handshake_exc = InvalidMessage(
552 "did not receive a valid HTTP request"
553 )
554 self.handshake_exc.__cause__ = exc
555 self.send_eof()
556 self.parser = self.discard()
557 next(self.parser) # start coroutine
558 yield
559
560 if self.debug:
561 self.logger.debug("< GET %s HTTP/1.1", request.path)
562 for key, value in request.headers.raw_items():
563 self.logger.debug("< %s: %s", key, value)
564
565 self.events.append(request)
566
567 yield from super().parse()
568
569
570class ServerConnection(ServerProtocol):

Callers

nothing calls this directly

Calls 5

InvalidMessageClass · 0.85
send_eofMethod · 0.80
raw_itemsMethod · 0.80
appendMethod · 0.80
discardMethod · 0.45

Tested by

no test coverage detected