#!/usr/bin/env python from http import server # Python 3 class MyHTTPRequestHandler(server.SimpleHTTPRequestHandler): def end_headers(self): if 'none' in self.path: self.send_header("content-encoding", "none") self.send_header("Access-Control-Allow-Origin", "*") if 'blank' in self.path: self.send_header("Access-Control-Allow-Origin", "*") #self.send_my_headers() server.SimpleHTTPRequestHandler.end_headers(self) """def send_my_headers(self): self.send_header("Access-Control-Allow-Origin", "*") self.send_header("content-encoding", "none")""" """ def do_GET(self) -> None: if 'none' in self.path: self.send_header("content-encoding", "none") self.send_header("Access-Control-Allow-Origin", "*") if 'blank' in self.path: self.send_header("Access-Control-Allow-Origin", "*") return super().do_GET()""" if __name__ == '__main__': server_port = 80 server.test(HandlerClass=MyHTTPRequestHandler, port=server_port)