poorconn.PatchableSocket

class poorconn.PatchableSocket(family=- 1, type=- 1, proto=- 1, fileno=None)

Bases: socket.socket

A class that allows some socket.socket functions to be patchable and thus can be wrapped.

Many functions such as socket.socket.accept() cannot be patched because it is builtin.

accept(*args, **kwargs)

Wraps accept() so that this function is patchable.

classmethod create_from(s)

Create a PatchableSocket object from s.

Parameters

s (socket.socket) – The socket.socket object to be created from.

Return type

PatchableSocket

send(*args, **kwargs)

Wraps send() so that this function is patchable.

sendall(*args, **kwargs)

Wraps sendall() so that this function is patchable.