Commit dfe6c3ee authored by Matthew Johnson's avatar Matthew Johnson
Browse files

[webserver] Update the webserver for python3

parent 83786873
......@@ -110,7 +110,7 @@ def start_ping(net):
def start_webserver(net):
h1 = net.get("h1")
proc = h1.popen("python", shell=True)
proc = h1.popen("python3", shell=True)
return [proc]
import SimpleHTTPServer
import SocketServer
""" A very basic stdlib http server
PORT = 80
Serves files out of the current working directory. Credit to updating for
python3 to Chris Gunn<>.
from http.server import SimpleHTTPRequestHandler, HTTPServer
PORT = 80
class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
class Handler(SimpleHTTPRequestHandler):
# Disable logging DNS lookups
def address_string(self):
return str(self.client_address[0])
Handler = Handler
httpd = SocketServer.TCPServer(("", PORT), Handler)
httpd = HTTPServer(("", PORT), Handler)
print("Server1: httpd serving at port", PORT)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment