Answer the question
In order to leave comments, you need to log in
How to refer to RequestHandlerClass in BaseHTTPServer?
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()
Answer the question
In order to leave comments, you need to log in
Nothing smarter
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)
.
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question