Other modules¶
quickrpc.announcer_api module¶
module ‘quickrpc.announcer_api’ undocumented
-
class
quickrpc.announcer_api.
AnnouncerAPI
(codec='jrpc', transport=None, security='null', invert=False, async_processing=False)[source]¶ Bases:
quickrpc.remote_api.RemoteAPI
AnnouncerAPI provides a means of discovering services in some kind of distributed system.
“Clients” broadcast a seek call. All “servers” who feel spoken to respond with an advertise call to the seeker.
-
quickrpc.announcer_api.
make_announcer
(transport, description='', filter_func=None, codec=<quickrpc.terse_codec.TerseCodec object>)[source]¶ Returns a ready-to-use announcer server running over the given transport.
Sets the transport’s API.
description is the service description to hand out.
filter_func is a predicate accepting the filter parameter of AnnouncerAPI.seek and returning True if the filter matches this service. If left out, it is assumed to be always True.
All you need to do afterwards is to call transport.start(). Keep a reference to the transport.
quickrpc.echo_api module¶
EchoAPI: simple chat server.
Demonstrates use of RemoteAPI as well as StdioTransport and TcpServerTransport.
The server responds to a “say” call with “echo” of the text to all clients. The message “quit”:
- if coming from stdio, shuts the server down
- if coming over a tcp connection, makes the server close the connection.
Run with python3 -m quickrpc.echo_api. Enter json messages on the commandline to test stdio transport. Use telnet localhost 8888 to test tcp functionality. Use tail -F echo_api.log in another terminal to watch logged events.
-
class
quickrpc.echo_api.
EchoAPI
(codec='jrpc', transport=None, security='null', invert=False, async_processing=False)[source]¶ Bases:
quickrpc.remote_api.RemoteAPI
Demo of how to use RemoteAPI.
Echo API answers incoming say calls with an echo call.
-
quickrpc.echo_api.
L
()¶ function ‘quickrpc.echo_api.L’ undocumented
quickrpc.util module¶
module ‘quickrpc.util’ undocumented
-
quickrpc.util.
paren_partition
(text)[source]¶ pop first parenthesized expression from a string.
The text must start with one of ({[<. The function finds the matching closing paren, then returns a tuple of (paren_content, paren, rest):
- paren_content is the text in parens, without the actual parens
- paren is the opening paren
- rest is what comes after the closing paren.
>>> paren_partition('(a (contrived) example)(foo)bar') ('a (contrived) example', '(', '(foo)bar')