internet application programming log_request([code [size]]logs successful request code is the http codeand size is the size of the response in bytes (if availableby defaultlog_message(is called for logging log_error(formatlogs an error message by defaultlog_message(is called for logging log_message(formatlogs an arbitrary message to sys stderr format is format string applied to any additional arguments passed the client address and current time are prefixed to every message here is an example of creating custom http server that runs in separate thread and lets you monitor the contents of dictionaryinterpreting the request path as key tryfrom http server import basehttprequesthandlerhttpserver except importerrorfrom basehttpserver import basehttprequesthandlerhttpserver py py class dictrequesthandler(basehttprequesthandler)def _init_ (self,thedict,*args,**kwargs)self thedict thedict basehttprequesthandler _init_ (self,*args,**kwargsdef do_get(self)key self path[ :strip the leading '/if not key in self thedictself send_error( "no such key"elseself send_response( self send_header('content-type','text/plain'self end_headers(resp "key % \nkey resp +"value% \nself thedict[keyself wfile write(resp encode('latin- ')example use 'name'dave''values[ , , , , ]'email'dave@dabeaz comfrom functools import partial serv httpserver(("", )partial(dictrequesthandler, )import threading d_mon threading thread(target=serv serve_foreverd_mon start(to test this examplerun the server and then enter url such as /name or contents of the dictionary being displayed this example also shows technique for how to get servers to instantiate handler classes with extra parameters normallyservers create handlers using predefined set of arguments that are passed to _init_ (if you want to add additional parametersuse the functools partial(function as shown this creates callable object that includes your extra parameter but preserves the calling signature expected by the server lib fl ff