]>
Commit | Line | Data |
---|---|---|
1 | from http.server import BaseHTTPRequestHandler, HTTPServer | |
2 | ||
3 | listen_address = ('', 8080) | |
4 | ||
5 | ||
6 | class HelloServer(BaseHTTPRequestHandler): | |
7 | def do_GET(self) -> None: | |
8 | self.send_response(200) | |
9 | self.send_header("Content-type", "text/html") | |
10 | self.end_headers() | |
11 | self.wfile.write(bytes("<html><body>Hello Web</body></html>", "utf-8")) | |
12 | ||
13 | ||
14 | def main() -> None: | |
15 | webServer = HTTPServer(listen_address, HelloServer) | |
16 | webServer.serve_forever() | |
17 | ||
18 | ||
19 | if __name__ == "__main__": | |
20 | main() |