<file_sep>from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from os import curdir, sep
import cgi

PORT_NUMBER = 8080

#class for request handling
class myHandler(BaseHTTPRequestHandler):

	#handler for GET request
	def do_GET(self):
		if self.path=="/":
			self.path="/response.html"

		try:
			f = open(curdir + sep + self.path) 
			self.send_response(200) #add status code
			self.send_header('Content-type', 'text/html') #proper mimetype
			self.end_headers() #close headers
			self.wfile.write(f.read()) #add file to response
			f.close()

		except IOError:
			self.send_error(404,'File Not Found: %s' % self.path)

#starting server script			
try:
	#create server instance
	server = HTTPServer(('', PORT_NUMBER), myHandler)
	print 'Started server on port ' , PORT_NUMBER

	#run server
	server.serve_forever()

except KeyboardInterrupt:
	print 'KeyboardInterrupt received, shutting server down'
	server.socket.close()<file_sep>
<head>
  <title>Head</title>
</head>
<body>
  <h1> Body: </h1>
  <ol>
    <li>Wed Dec 21 08:55:28 2016</li>
    <li>Wed Dec 21 08:55:29 2016</li>
    <li>Wed Dec 21 08:55:34 2016</li>
    <li>Wed Dec 21 08:55:35 2016</li>
    <li>Wed Dec 21 08:55:37 2016</li>
    <li>Wed Dec 21 08:55:38 2016</li>
    <li>Wed Dec 21 08:55:39 2016</li>
  </ol>
</body>
<file_sep>import os
FILE = 'response.html'

class Response:
  def __init__(self):
    self.file = os.open(os.curdir + os.sep + FILE, os.O_RDWR|os.O_CREAT)
    os.ftruncate(self.file, 0)
    os.lseek(self.file, 0, os.SEEK_SET)
    os.write(self.file,
"""
<head>
  <title>Head</title>
</head>
<body>
  <h1> Body: </h1>
  <ol>
  </ol>
</body>
"""
    )
    
  def up(self,time):
    os.lseek(self.file, -14, os.SEEK_END)
    os.write(self.file, "  <li>" + time +
"""</li>
  </ol>
</body>
"""
)

