from http import server

class MyHandler(server.SimpleHTTPRequestHandler):
    def my_headers(self):
        self.send_header('Cross-Origin-Opener-Policy', 'same-origin')
        self.send_header('Cross-Origin-Embedder-Policy', 'require-corp')

    def end_headers(self) -> None:
        self.my_headers()
        super().end_headers()

if __name__ == "__main__":
    server.test(HandlerClass=MyHandler)