-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathnde.py
More file actions
25 lines (17 loc) · 695 Bytes
/
nde.py
File metadata and controls
25 lines (17 loc) · 695 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
#!/usr/bin/env python3
from http.server import HTTPServer, BaseHTTPRequestHandler
import configuration
from requesthandler import RequestHandler
def http_run(server_class=HTTPServer, handler_class=BaseHTTPRequestHandler):
server_address = (configuration.ListenAddress, configuration.ListenPort)
httpd = server_class(server_address, handler_class)
httpd.serve_forever()
if __name__ == '__main__':
print("Starting NDE on 'http://{0}:{1}/'".format(configuration.ListenAddress, configuration.ListenPort))
try:
http_run(HTTPServer, RequestHandler)
except KeyboardInterrupt:
pass
except Exception as exc:
print(exc)
print("NDE stopped")