import http.server
import socketserver

PORT = 80
DIRECTORY = "/var/www/html/sdk"

class TextHandler(http.server.SimpleHTTPRequestHandler):
    def guess_type(self, path):
        # Force everything to be treated as plain text
        return 'text/plain; charset=utf-8'

    def translate_path(self, path):
        # Ensure we serve from the correct directory
        root = DIRECTORY
        path = super().translate_path(path)
        relpath = path.replace(root, "")
        return DIRECTORY + relpath

with socketserver.TCPServer(("", PORT), TextHandler) as httpd:
    print("Serving at port", PORT)
    httpd.serve_forever()
