#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from http.server import HTTPServer, CGIHTTPRequestHandler

verbose = False

port = 8080

class Handler(CGIHTTPRequestHandler):
  cgi_directories = ["/"]
  # suppress printing of log messages
  def log_message(self, format, *args):
    None

httpd = HTTPServer(("", port), Handler)
if(verbose):
  print("CGI HTTP server at port %d" % port)

try:
  httpd.serve_forever()
except KeyboardInterrupt:
  if(verbose):
    print("Stopping CGI HTTP server.")