-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSysStatWeb.py
More file actions
executable file
·36 lines (27 loc) · 956 Bytes
/
SysStatWeb.py
File metadata and controls
executable file
·36 lines (27 loc) · 956 Bytes
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
28
29
30
31
32
33
34
35
36
#!./venv/bin/python3
# Please execute this script from the project root directory and not "src"
import FileSys
import WebEndpoint
import argparse
from http.server import HTTPServer
import json
from typing import Dict
def load_config(config_file: str) -> Dict:
''' Load configuration data for web server.
Args:
config_file(str): Path to configuration file.
Returns:
Dictionary loaded from JSON configuration data.
'''
config_data = {}
with open(config_file, "r") as config:
config_data = json.loads(config.read())
return config_data
if __name__ == "__main__":
config_data = load_config("./cfg/SysStatWeb.json")
address = config_data["web_server"]["address"]
port = config_data["web_server"]["port"]
web_server = HTTPServer((address, port),
WebEndpoint.Handler)
print(f"[INFO] Web server running on {address}:{port}")
web_server.serve_forever()