Search notes:

Python standard library: socket

gethostname

import socket
print(socket.gethostname())
Compare with socket.getfqdn() and platform.node

See also

standard library, socketserver
Using selectors to implement a simple echo server.

Index