Package: async-rpc
Non-blocking XML-RPC client for Python. Provides base classesasync_rpc.BaseSerializerandasync_rpc.BaseServerProxy,
you can write your own implementation of RPC (JSON RPC, …).Usagefromasync_rpcimportXmlRpcServerProxyasyncdefget_data():proxy=XmlRpcServerProxy('http://example.com/RPC2:8000')response=awaitproxy.methodName(123,456)returnresponseAPI documentationclassasync_rpc.BaseRpcServerProxy(uri, timeout=None,
max_clients=None, user_agent=None, use_dns_cache=None, ttl_dns_cache=None,
http_version=None, keepalive_timeout=None, **kwargs)Base class for server proxies. It is responsible for HTTP transport. For
concrete RPC implementation uses descendant of theBaseSerializer.uri(str) – URL of the remote servertimeout(float) – timeout in seconds for network operations,
includes DNS requests, default is 1.0 seconds.max_clients(int) – size of the connections pool,
default is 16 connections.user_agent(str) – user agent which is sent to server,
default is"Pythonasync-rpc".use_dns_cache(bool) – use internal cache for DNS lookups,
default isTrue.ttl_dns_cache(float) – store DNS lookups into internal cache
for attl_dns_cacheseconds, default is 10.0 seconds.http_version(str) – version of the HTTP protocol, can be"1.0"or"1.1", default is"1.0".keepalive_timeout(float) – close connection afterkeepalive_timeoutseconds, ifNone, keep-alive is disabled, default isNone.kwargs(dict) – additional keyword arguments, which will be passed
into serializer constructor.attributeasync_rpc.BaseRpcServerProxy.serializer_cls(BaseSerializer) – serializer classcoroutineasync_rpc.BaseRpcServerProxy.call(name, **params)name(str) – mame of the remote function.params(dict) – parameters, which will be passed to remote function.Instance of theBaseServerProxyis callable, so you can call remote
function directly on server proxy instance. These calls are equivalent:res=awaitproxy.getData('12345678901234567890')res=awaitproxy.call('getData','12345678901234567890')classasync_rpc.BaseSerializer(**kwargs)Ancestor for concrete implementation of RPC. Contains four abstract methods,
which must be overriden in inherited classes.kwargs(dict) – additional keyword arguments, which are passed from
server proxy.methodasync_rpc.BaseSerializer.initialize(**kwargs)Initialize instance. It is called from constructor when instance is
created.kwargs(dict) – additional keyword arguments, which are passed from
server proxy.abstractmethodasync_rpc.BaseSerializer.prepare_request_headers(params)Returndictcontainig HTTP headers. Method is called before RPC call
is sent. You can add additional HTTP header, which are be sent in request
to remote server.params(tuple) – params for RPC call.abstractmethodasync_rpc.BaseSerializer.dumps(response_headers)Return data, which will be sent as POST body in request to remote
server. Method is called before RPC call is sent.params(tuple) – params for RPC call.menthodname(str) – name of the RPC method.abstractmethodasync_rpc.BaseSerializer.process_response_headers(response_headers)Check headers from response. Method is called after response is
received from server.response_headers(Mapping) – mapping containing response
HTTP headers.abstractmethodasync_rpc.BaseSerializer.loads(data,
response_headers)Return response from remote server as Python objects. Method is
called after response is received from server.data(bytes) – response body.response_headers(Mapping) – mapping containing response
HTTP headers.License3-clause BSD