Question on how to supress console logging from BaseHTTPServer Module?

David Lees DavidLNoSpammy at raqia.com
Fri May 25 13:50:33 EDT 2001


Mystery fully solved.  Another of my newbie mistakes below.
BaseHTTPRequestHandler is in the BaseHTTPServer module, which means the
reference to BaseHTTPRequestHandler needs to be qualified with the
BaseHTTPServer name when use.

Thanks Alex and Michael.

David Lees

David Lees wrote:
> 
> Thanks, this works great.  I am an OO newbie or I would have immediately
> done this.  I added:
> 
> class QuietBaseHTTPRequestHandler(BaseHTTPRequestHandler):
>     def send_response(self, code, message=None):
>         pass
> 
> One minor thing, I still had to go to the BaseHTTPServer.py module and
> add the subclassing, rather than having it in my program code.  Clearly
> there is something really basic about namespace that I am missing.  Any
> idea what the problem is?
> 
> David Lees
> 
> Alex wrote:
> >
> > Probably the best way is to subclass BaseHTTPServer and overwrite the
> > log_request method.  Something like
> >
> > class quietHTTPServer(BaseHTTPServer):
> >
> >     def log_request(self, code): pass
> >
> > HTH
> > Alex.



More information about the Python-list mailing list