Quoth flagg <ianand0...@gmail.com>: > Let me see if i can elaborate on the requirements. I have 20+ > different zone files. I want the xmlrpc server to be able to > determine what zone file to open by looking at the incoming xml > request. For example one of the functions I have now is to show a DNS > record (I am using dnspython for most of this work) > > If i send an xmlrpc request that uses the 'showRecord' function with > params of 'oracle1.foo.bar.com' I want to parse the "params" piece > and then instruct the xml-rpc server to open foo.bar.com.zone for > reading. The reason why i was looking at do_Post() and _dispatch was > to attempt to read the incoming params and do exactly that. > > Do you think there is an easier way of accomplishing this, than the > way I am going about it?
Yeah. Take a look at the SimpleXLMRPC documentation: http://docs.python.org/library/simplexmlrpcserver.html In addition to setting up the server as instructed (let's assume you assign it to the variable 'server'), you just need to do something like: class MyFunctions: def showRecord(self, dnsname): domain = '.'.join(dnsname.split('.')[1:]) with open(domain+'.zone')) as myfile: # do stuff with data from myfile server.register_instance(MyFunctions()) You would modify the body of that function to meet your processing requirements, of course. That is, SimpleXMLRPCServer does the request parsing for you, calls the correspondingly named method, and passes it the params as method arguments. (This example is taken from the SimpleXMLRPC documentation, I just selected one particular way of exposing the methods: via a class instance). --RDM -- http://mail.python.org/mailman/listinfo/python-list