473,408 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

SimpleXMLRPCServer - disable output

Hi,
I thought I posted this, but its been about 10min and hasnt shown up
on the group.
Basically I created a SimpleXMLRPCServer and when one of its methods
gets called and it returns a response to the client, the server prints
some info out to the console, such as,

localhost - - [14/Apr/2005 16:06:28] "POST /RPC2 HTTP/1.0" 200 -

Anyhow, is there a way I can surpress that so its not printed to the
console? I looked at SimpleXMLRPCServer.py ...it doesn't explicitly
print that, I think perhaps std is...but not sure. Any ideas??

thanks.

Jul 19 '05 #1
4 2308

codecraig> I thought I posted this, but its been about 10min and hasnt
codecraig> shown up on the group.

Patience...

codecraig> localhost - - [14/Apr/2005 16:06:28] "POST /RPC2 HTTP/1.0" 200 -

codecraig> Anyhow, is there a way I can surpress that so its not printed
codecraig> to the console? I looked at SimpleXMLRPCServer.py ...it
codecraig> doesn't explicitly print that, I think perhaps std is...but
codecraig> not sure. Any ideas??

Introspection is your friend:
import SimpleXMLRPCServer
for a in dir(SimpleXMLRPCServer):

... matches = [m for m in dir(getattr(SimpleXMLRPCServer, a))
... if m.find("log") != -1]
... if matches:
... print "***", a, "***"
... print matches
...
*** SimpleXMLRPCRequestHandler ***
['log_date_time_string', 'log_error', 'log_message', 'log_request']
*** os ***
['getlogin']

Skip
Jul 19 '05 #2
codecraig wrote:
Hi,
I thought I posted this, but its been about 10min and hasnt shown up
on the group.
Basically I created a SimpleXMLRPCServer and when one of its methods
gets called and it returns a response to the client, the server prints
some info out to the console, such as,

localhost - - [14/Apr/2005 16:06:28] "POST /RPC2 HTTP/1.0" 200 -

Anyhow, is there a way I can surpress that so its not printed to the
console? I looked at SimpleXMLRPCServer.py ...it doesn't explicitly
print that, I think perhaps std is...but not sure. Any ideas??

thanks.

Here's the entire SimpleMLRPCServer class from SimpleXMLRPCServer.py:
class SimpleXMLRPCServer(SocketServer.TCPServer,
SimpleXMLRPCDispatcher):
"""Simple XML-RPC server.

Simple XML-RPC server that allows functions and a single instance
to be installed to handle requests. The default implementation
attempts to dispatch XML-RPC calls to the functions or instance
installed in the server. Override the _dispatch method inhereted
from SimpleXMLRPCDispatcher to change this behavior.
"""

def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler,
logRequests=1):
self.logRequests = logRequests

SimpleXMLRPCDispatcher.__init__(self)
SocketServer.TCPServer.__init__(self, addr, requestHandler)

You should be able to change logRequests to 0 and that should fix it. I just tested it at a prompt and it worked just fine.
Jeremy Jones

Jul 19 '05 #3

Jeremy Jones wrote:
codecraig wrote:
Hi,
I thought I posted this, but its been about 10min and hasnt shown upon the group.
Basically I created a SimpleXMLRPCServer and when one of its methodsgets called and it returns a response to the client, the server printssome info out to the console, such as,

localhost - - [14/Apr/2005 16:06:28] "POST /RPC2 HTTP/1.0" 200 -

Anyhow, is there a way I can surpress that so its not printed to the
console? I looked at SimpleXMLRPCServer.py ...it doesn't explicitly
print that, I think perhaps std is...but not sure. Any ideas??

thanks.
Here's the entire SimpleMLRPCServer class from SimpleXMLRPCServer.py:
class SimpleXMLRPCServer(SocketServer.TCPServer,
SimpleXMLRPCDispatcher):
"""Simple XML-RPC server.

Simple XML-RPC server that allows functions and a single instance
to be installed to handle requests. The default implementation
attempts to dispatch XML-RPC calls to the functions or instance
installed in the server. Override the _dispatch method inhereted
from SimpleXMLRPCDispatcher to change this behavior.
"""

def __init__(self, addr,

requestHandler=SimpleXMLRPCRequestHandler, logRequests=1):
self.logRequests = logRequests

SimpleXMLRPCDispatcher.__init__(self)
SocketServer.TCPServer.__init__(self, addr, requestHandler)

You should be able to change logRequests to 0 and that should fix it. I just tested it at a prompt and it worked just fine.

Jeremy Jones


Jeremy,
So can you explain what I can do to set logRequests = 0? Do i just
do..

server = SimpleXMLRPCServer(0) ???

I am sorta new to python thanks.

Jul 19 '05 #4
Jeremy,
Thanks for clearing that up. I am so used to java (i.e.
foo.setLogRequests(0))...that I forgot I could just do, foo.logRequests
= 0.

Learning one day at a time :)

Thanks.

Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Marco Aschwanden | last post by:
I would like to develop a server based on python's xmlrpc. But I realized that SimpleXMLRPCServer does not spawn a thread for each request. How could the SimpleXMLRPCServer be turned into a...
3
by: Maxim Khesin | last post by:
Hi, the typical usage of SimpleXMLRPCServer registers some class with the server instance and then jumps into a serve-forever loop, e.g. server = SimpleXMLRPCServer(('', 8000))...
0
by: Thomas G. Apostolou | last post by:
Hello all, I use Python 2.3.3 and try to patch SimpleXMLRPCServer.py with the patch i got from Python.org. so after changing to the directory where both SimpleXMLRPCServer.py and...
0
by: JDF | last post by:
I am trying to create a Windows service using SimpleXMLRPCServer and win32serviceutil. The service itself seems to be working properly (starts, stops, etc) and I can connect using an XMLRPC client...
2
by: Laszlo Nagy | last post by:
Hello, I ran in the same problem again. Many others have the same problem. Just Google for this: "SimpleXMLRPCServer allow_none site:python.org". Looks like the 'allow_none' patch was commited...
0
by: Juju | last post by:
Hi, First, sorry for my poor English ! I used the SimpleXMLRPCServer facility of Python to develop a multithread-server, here's part of my code : -- class...
0
by: Rudy Schockaert | last post by:
After some Googling I found a post of someone who wanted to do exactly as what I want to do now. There is however a problem in his code that makes the service fails after the first connection. I...
3
by: Achim Domma | last post by:
Hi, is SimpleXMLRPCServer multithreaded or how does it handle multiple clients? I want to implement a simple server which will be queried by multiple processes for work to be done. The server...
9
by: Bret | last post by:
I'm coming back to Python after an absence and it's surprising how many things I've forgotten since wandering (against my will) into Java land. Anyway, I have a need for a way to make...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.