MCPcopy
hub / github.com/urllib3/urllib3 / _read_exactly

Function _read_exactly

test/contrib/test_socks.py:50–61  ·  view source on GitHub ↗

Read *exactly* ``amt`` bytes from the socket ``sock``.

(sock: socket.socket, amt: int)

Source from the content-addressed store, hash-verified

48
49
50def _read_exactly(sock: socket.socket, amt: int) -> bytes:
51 """
52 Read *exactly* ``amt`` bytes from the socket ``sock``.
53 """
54 data = b""
55
56 while amt > 0:
57 chunk = sock.recv(amt)
58 data += chunk
59 amt -= len(chunk)
60
61 return data
62
63
64def _read_until(sock: socket.socket, char: bytes) -> bytes:

Callers 3

_address_from_socketFunction · 0.85

Calls 1

recvMethod · 0.45

Tested by

no test coverage detected