FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
run_webassembly.py
Go to the documentation of this file.
1#! /usr/bin/python3
2from http.server import HTTPServer, SimpleHTTPRequestHandler
3import sys
4import webbrowser
5
6PORT = 8888
7
8class CustomHTTPRequestHandler(SimpleHTTPRequestHandler):
9 def end_headers(self):
10 self.send_header("cross-origin-embedder-policy", "require-corp")
11 self.send_header("cross-origin-opener-policy", "same-origin")
12 SimpleHTTPRequestHandler.end_headers(self)
13
14with HTTPServer(("", PORT), CustomHTTPRequestHandler) as httpd:
15 try:
16 webbrowser.open("http://localhost:%s" % PORT)
17 print("serving at port", PORT)
18 httpd.serve_forever()
19 finally:
20 sys.exit(0)