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

Function accept_key

src/websockets/utils.py:26–35  ·  view source on GitHub ↗

Compute the value of the Sec-WebSocket-Accept header. Args: key: Value of the Sec-WebSocket-Key header.

(key: str)

Source from the content-addressed store, hash-verified

24
25
26def accept_key(key: str) -> str:
27 """
28 Compute the value of the Sec-WebSocket-Accept header.
29
30 Args:
31 key: Value of the Sec-WebSocket-Key header.
32
33 """
34 sha1 = hashlib.sha1((key + GUID).encode()).digest()
35 return base64.b64encode(sha1).decode()
36
37
38def apply_mask(data: BytesLike, mask: bytes | bytearray) -> bytes:

Callers 5

test_accept_keyMethod · 0.90
process_responseMethod · 0.85
process_requestMethod · 0.85

Calls 2

encodeMethod · 0.45
decodeMethod · 0.45

Tested by 3

test_accept_keyMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…