Domanda

How using Python I can dynamically generate my call to my xmlrpc server using xmlrpc lib? something like

def call_method(method_name)
   server = Server(self.URL, transport=ProxiedTransport())
   server.method_name(params)

The resolution takes method_name instead of for example if method_name=get_time: server.get_time(params).

È stato utile?

Soluzione

The source of xmlrpclib contains this comment, which you might find applicable outside its original context.

   # note: to call a remote object with an non-standard name, use
   # result getattr(server, "strange-python-name")(args)

It's a general Python idiom.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top