Question on how to supress console logging from BaseHTTPServer Module?

Emile van Sebille emile at fenx.com
Thu May 24 09:49:27 EDT 2001


This works for me:

>>> from BaseHTTPServer import BaseHTTPRequestHandler
>>> class QuietBaseHTTPRequestHandler(BaseHTTPRequestHandler):
    def send_response(self, code, message=None):
        pass

Perhaps you did an import instead of a from...import...?

--

Emile van Sebille
emile at fenx.com

---------
"David Lees" <DavidLNoSpammy at raqia.com> wrote in message
news:3B0D0CFA.C42F21C4 at raqia.com...
> 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