I want to extend SimpleHTTPRequestHandler and override the default behavior do_GET(). I am returning a string from my custom handler, but the client does not receive a response.
Here is my handler class:
DUMMY_RESPONSE = """Content-type: text/html
<html>
<head>
<title>Python Test</title>
</head>
<body>
Test page...success.
</body>
</html>
"""
class MyHandler(CGIHTTPRequestHandler):
def __init__(self,req,client_addr,server):
CGIHTTPRequestHandler.__init__(self,req,client_addr,server)
def do_GET(self):
return DUMMY_RESPONSE
What should I change to make this work right?
source
share