Package: xmlrpcutils
xmlrpcutilsxmlrpc server simplify.Installpip install xmlrpcutilsTestServerfrom xmlrpcutils.server import SimpleXmlRpcServer
from xmlrpcutils.service import ServiceBase

class SayHelloService(ServiceBase):

    def hello(self, name):
        return f"Hello {name}, how are you!"

class TestServer(SimpleXmlRpcServer):
    
    def register_services(self):
        super().register_services()
        SayHelloService(namespace="debug").register_to(self.server)

app =  TestServer()
app_ctrl = app.get_controller()

if __name__ == "__main__":
    app_ctrl()Start test serverpython test_server.py startRemote call with TestServerIn [9]: from xmlrpc.client import ServerProxy

In [10]: server = ServerProxy('http://127.0.0.1:8381')

In [11]: server.system.listMethods()
Out[11]:
['debug.counter',
 'debug.echo',
 'debug.false',
 'debug.hello',
 'debug.hostname',
 'debug.null',
 'debug.ping',
 'debug.sleep',
 'debug.sum',
 'debug.timestamp',
 'debug.true',
 'debug.uname',
 'debug.urandom',
 'debug.uuid4',
 'system.listMethods',
 'system.methodHelp',
 'system.methodSignature',
 'system.multicall']

In [12]: server.debug.hello('zencore')
Out[12]: 'Hello zencore, how are you!'Use apikey auth mechanism.Addapikeysin the server's config fileapikeys:
  HyuTMsNzcSZYmwlVDdacERde9azdTKT8:
    appid: test01
    other-app-info: xxx
  SEEpVkus5b86aHxS6UMSCFLxkIhYMMZF:
    appid: test02
    other-app-info: xxxAddapikeyheader at the client sideIn [93]: from xmlrpc.client import ServerProxy
    ...: service = ServerProxy("http://127.0.0.1:8911", headers=[("apikey", "HyuTMsNzcSZYmwlVDdacERde9azdTKT8")])
    ...: result = service.debug.ping()
    ...: print(result)
pongEnable server http-keepalivekeepalive:
    enable: true
    timeout: 5
    max: 60Http-keepalive is not enabled by default, add keepalive.enable=true to enable it.Enable server response headerserver-tokens: trueThe response header Server is hide by default, add server-tokens=true to show it.Enable methodSignaturedef myfunc1(arg1:int, arg2:str, arg3:list) -> str:
    passAdd returns and args typing to enable methodSignature.Multiple signatures can NOT be auto detected.def myfunc2(arg1, arg2, arg3=None):
    """
     @methodSignature: ["str", "int", "str"]
    @methodSignature: ["str", "int", "str", "list"]
    """
    passUse doc string @methodSignature: to enable methodSignature.Use doc string @methodSignature many times for multiple signatures.def myfunc3(args, arg1, arg2, arg3):
    pass
myfunc3._methodSignature = ["str", "int", "str", "list"]

def myfunc4(args, arg1, arg2, arg3=None):
    pass
myfunc4._methodSignature = [
    ["str", "int", "str],
    ["str", "int", "str", "list"],
]Use extra attr to enable methodSignature.NotePython3.7 or older does not support using parameterheadersin ServerProxy. Therefore, you need to use the client of a higher version when the server requires APIKEY-HEADER verification. Or customize a transport for ServerProxy.Releasesv0.1.1First release.v0.1.2Fix license_files missing problem.v0.1.3Fix DebugService init method problem, add super().init() calling.v0.2.0Don't force to use gevent.Allow non-namespace services.v0.3.1Remove all gevent things.Add apikey auth mechanism. Use headers parameter to provide apikey at then client side.v0.3.2Fix get_ignore_methods name.v0.4.0Add server-tokens option, allow user hide/show response header Server. Default to hide the Server header.Add keepalive options, allow user to enable http-keepalive function.v0.4.2Doc update.v0.4.3Doc fix.Add methodSignature support.v0.4.4Fix methodSignature respose data type. It should be [[...], [...]] type or const string "signatures not supported".