from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
class aaa(BaseHTTPRequestHandler):
def do_GET(self):
self.wfile.write("Hello World")
if __name__ == "__main__":
server = HTTPServer(("", 8888), aaa)
server.serve_forever()
It's a practice to create a web server in Python. but, I do not know how to check the results.
Open a web browser and type
http://localhost:8888/
into the address bar. If you seeHello World
, it worked. Otherwise, it didn't.Whether or not it worked, you can see the actual results returned like this. Open a command prompt and type:
after the connection completes, type:
and hit enter twice.
Then the response from the web server should appear.