def start_webserver_any_free_port(ip, webroot, handler=WebHandler):
 web_server = HTTPServer((ip, 0), webroot, handler)
 server_thread = threading.Thread(target=web_server.serve_forever)
 server_thread.name = 'WebServer'
 server_thread.daemon = True
 server_thread.start()
 web_server.wait_for_start()
 return (server_thread, web_server.get_port())

def start_webserver_any_free_port ( ip , webroot , handler = WebHandler ) : web_server = HTTPServer ( ( ip , 0 ) , webroot , handler ) server_thread = threading . Thread ( target = web_server . serve_forever ) server_thread . name = 'WebServer' server_thread . daemon = True server_thread . start ( ) web_server . wait_for_start ( ) return ( server_thread , web_server . get_port ( ) )
create a http server daemon in any free port available .