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

Function parse_extension

src/websockets/headers.py:363–386  ·  view source on GitHub ↗

Parse a ``Sec-WebSocket-Extensions`` header. Return a list of WebSocket extensions and their parameters in this format:: [ ( 'extension name', [ ('parameter name', 'parameter value'), ....

(header: str)

Source from the content-addressed store, hash-verified

361
362
363def parse_extension(header: str) -> list[ExtensionHeader]:
364 """
365 Parse a ``Sec-WebSocket-Extensions`` header.
366
367 Return a list of WebSocket extensions and their parameters in this format::
368
369 [
370 (
371 'extension name',
372 [
373 ('parameter name', 'parameter value'),
374 ....
375 ]
376 ),
377 ...
378 ]
379
380 Parameter values are :obj:`None` when no value is provided.
381
382 Raises:
383 InvalidHeaderFormat: On invalid inputs.
384
385 """
386 return parse_list(parse_extension_item, header, 0, "Sec-WebSocket-Extensions")
387
388
389parse_extension_list = parse_extension # alias for backwards compatibility

Callers 6

process_extensionsMethod · 0.85
process_extensionsMethod · 0.85
process_extensionsMethod · 0.85
process_extensionsMethod · 0.85
test_parse_extensionMethod · 0.85

Calls 1

parse_listFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…