sockets in python in the above diagram the user is using browser (such as chromeie or safarito access web server the browser is running on their local machine (which could be pca maca linux boxan ipada smart phone etc to access the web server they enter url (universal resource locatoraddress into their browser in the example this is the url www foo com it also indicates that they want to connect up to port (rather than the default port used for http connectionsthe remote machine (which is the one indicated by the address www foo comreceives this request and determines what to do with it if there is no program monitoring port it will reject the request in our case we have python program (which is actually the web server programlistening to that port and it is passed the request it will then handle this request and generate response message which will be sent back to the browser on the users local machine the response will indicate which version of the http protocol it supportswhether everything went ok or not (this is the code in the above diagram you may have seen the code indicating that web page was not found etc the browser on the local machine then renders the data as web page or handles the data as appropriate etc to create simple python web server the http server httpserver can be used directly or can be subclassed along with the socketserver threadingmixin to create multi-threaded web serverfor exampleclass threadinghttpserver(threadingmixinhttpserver)"""simple multi-threaded http server ""pass since python the http server module now provides exactly this class as built in facility and it is thus no longer necessary to define it yourself (see http server threadinghttpserverto handle http requests you must implement one of the http request methods such as do_get()or do_post(each of these maps to type of http requestfor exampledo_get(maps to http get request that is generated if you type web address into the url bar of web browser or do_post(maps to http post request that is used for examplewhen form on web page is used to submit data to web server the do_get(selfor do_post(selfmethod must then handle any input supplied with the request and generate any appropriate responses back to the browser this means that it must follow the http protocol