PrintBuddy/webserver.py

15 lines
373 B
Python

from http.server import BaseHTTPRequestHandler
import pageresolver
class WebServer(BaseHTTPRequestHandler):
def do_GET(self):
# Create page contents
(responseCode, page) = pageresolver.resolve(self.path)
# Return page
self.send_response(responseCode)
self.send_header("Content-type", "text/html")
self.end_headers()
self.wfile.write(bytes(page, "utf-8"))