문제

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).

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top