I do not know how to check the results. (BaseHTTPRequestHandler)

305 views Asked by At
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.

1

There are 1 answers

2
Robᵩ On

Open a web browser and type http://localhost:8888/ into the address bar. If you see Hello 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:

telnet localhost 8888

after the connection completes, type:

GET / HTTP/1.0

and hit enter twice.

Then the response from the web server should appear.