Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   A Simple Server to Capture Single Short Requests (http://www.velocityreviews.com/forums/t329081-a-simple-server-to-capture-single-short-requests.html)

Craig Edgmon 03-02-2004 05:47 PM

A Simple Server to Capture Single Short Requests
 
I am working through Steve Holdens book on Python Web Development and
this may seem like an obvious question, but my error states that
MyRequestHandler is not defined. Any ideas on this?

import SocketServer

class MyRequestHandler(SocketServer.BaseRequestHandler):
def handle(self):
print "_____________________________"
print "From: ", self.client_address
print "_____________________________"
input = self.request.recv(10240)
print input.replace('\r', '')
print "_____________________________"
self.request.send("HTTP/1.1 200 OK\r\n")
self.request.send("Content-Type: text/html\n\n")
self.request.send("<HTML><BODY><H2>Hello!</H2></BODY></HTML>")
self.request.close()

myServer = SocketServer.TCPServer(('', 8080), MyRequestHandler)
myServer.handle_request()





All times are GMT. The time now is 09:09 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.