This commit is contained in:
Christoph J. Scherr 2023-09-04 19:09:18 +02:00
parent fa615d8321
commit 2297220759
1 changed files with 16 additions and 0 deletions

16
src/miniweb.py Normal file
View File

@ -0,0 +1,16 @@
import http.server
import io
class MyHandler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
self.send_head()
def send_head(self):
body = "hello world"
self.send_response(200)
self.send_header("Content-type", "text/html; charset=utf-8")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
return io.StringIO(body)
addtrss = ("127.0.0.1", 8080)
srv = http.server.HTTPServer(addtrss, MyHandler)
srv.serve_forever()