This is a very Putin way:
threading.Thread(target=myServer.serve_forever).start()
I do not see how this can be obscure or overly verbose. If you want the program to exit after the main thread completes, add daemon=True to the Thread call.
An alternative is to call handle_request in a loop on your own, but this is not like your case with the web server.
source share