import SocketServer import SimpleHTTPServer class Reply(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): # The query arrives in self.path. You should prepare your # response here, preferably by calling suitable functions. # The following line merely echoes the query; replace it # with code that generates the desired response. self.wfile.write("query was %s\n" % self.path) # replace this line def main(): # You must read and parse courses.json here, # before starting the server. SocketServer.ForkingTCPServer(('', 8080), Reply).serve_forever() main()