http server the following short program creates simple web server that will generate welcome message and the current time as response to get request it does this by using the datetime module to create time stamp of the date and time using the today(function this is converted into byte array using the utf- character encoding (utf- is the most widely used way to represent text within web pageswe need byte array as that is what will be executed by the write(method later on having done this there are various items of meta data that need to be set up so that the browser knows what data it is about to receive this meta data is known as header data and can including the type of content being sent and the amount of data (contentbeing transmitted in our very simple case we need to tell it that we are sending it plain text (rather than the html used to describe typical web pagevia the 'content-typeheader information we also need to tell it how much data we are sending using the content length we can then indicate that we have finished defining the header information and are now sending the actual data the data itself is sent via the wfile attribute inherited from the basehttprequesthandler there are infact two related attributes rfile and wfilerfile this is an input stream that allows you to read input data (which is not being used in this examplewfile holds the output stream that can be used to write (senddata to the browser this object provides method write(that takes byte-like object that is written out to (eventuallythe browser main(method is used to set up the http server which follows the pattern used for the tcpserverhowever the client of this server will be web browser from http server import basehttprequesthandlerthreadinghttpserver from datetime import datetime class myhttprequesthandler(basehttprequesthandler)"""very simple request handler only supports get ""def do_get(self)print("do_get(starting to process request"welcome_msg 'hello from server at str(datetime today()byte_msg bytes(welcome_msg'utf- 'self send_response( self send_header("content-type"'text/plaincharsetutf- '