Skip to content

Commit b66c477

Browse files
author
Jakub Stasiak
committed
Add BaseRequestHandler instance attributes
From the BaseRequestHandler documentation: handle() This function must do all the work required to service a request. The default implementation does nothing. Several instance attributes are available to it; the request is available as self.request; the client address as self.client_address; and the server instance as self.server, in case it needs access to per-server information. The type of self.request is different for datagram or stream services. For stream services, self.request is a socket object; for datagram services, self.request is a pair of string and socket. I also added a union that expresses the fact that client_address can be a string in case of using Unix domain sockets.
1 parent c1b1297 commit b66c477

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

stdlib/3/socketserver.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ class ThreadingTCPServer(ThreadingMixIn, TCPServer): ...
6969
class ThreadingUDPServer(ThreadingMixIn, UDPServer): ...
7070

7171
class BaseRequestHandler:
72+
request = ... # type: Union[SocketType, Tuple[bytes, SocketType]]
73+
client_address = ... # type: Union[Tuple[str, int], str]
74+
server = ... # type: BaseServer
7275
def setup(self) -> None: ...
7376
def handle(self) -> None: ...
7477
def finish(self) -> None: ...

0 commit comments

Comments
 (0)