blob: 231a16a52281a953fdbb834517f94ba08988e910 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import http.server
from config import *
from endpoints.get_plist import *
class MyServer(http.server.BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header("Content-type", "application/json")
self.send_header("Access-Control-Allow-Origin", "*")
self.send_header("Access-Control-Allow-Headers", "content-type")
self.end_headers()
output = Get_Plist.main()
self.wfile.write(output.encode())
if __name__ == "__main__":
webServer = http.server.HTTPServer((Config.hostName, Config.serverPort), MyServer)
print("Server started http://%s:%s" % (Config.hostName, Config.serverPort))
try:
webServer.serve_forever()
except KeyboardInterrupt:
pass
webServer.server_close()
print("Server stopped.")
|