2021-05-14 21:04:23 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
from http.server import HTTPServer, SimpleHTTPRequestHandler, test
|
|
|
|
import sys
|
|
|
|
|
|
|
|
class CORSRequestHandler(SimpleHTTPRequestHandler):
|
|
|
|
def end_headers(self):
|
|
|
|
self.send_header('Access-Control-Allow-Origin', '*')
|
2021-05-17 19:35:11 +00:00
|
|
|
self.send_header('Access-Control-Allow-Methods', 'GET')
|
|
|
|
self.send_header('Access-Control-Allow-Headers', '*')
|
2021-05-14 21:04:23 +00:00
|
|
|
SimpleHTTPRequestHandler.end_headers(self)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
test(CORSRequestHandler, HTTPServer, port=int(sys.argv[1]) if len(sys.argv) > 1 else 8000)
|