try:
server = http.server.HTTPServer(("", 8080), Handler_http)
print ("started httpserver...")
server.serve_forever()
except KeyboardInterrupt:
print ("^C received, shutting down server")
server.socket.close()
class Handler_http(BaseHTTPRequestHandler):
dataset = {}
try:
f = open('data.pickle', 'rb')
dataset = pickle.load(f)
except:
pass
def save_data(self):
with open('data.pickle', 'wb') as f:
pickle.dump(Handler_http.dataset, f)
.
.