Daemon helper for the ANSWER
A wrapper to easily adapt gRPC communication without implementing protobuf.
Print help message:
python -m reccd --helpPrint version number:
python -m reccd --versionPrints a list of available modules:
python -m reccd -vvv modulesStart the gRPC daemon server:
python -m reccd -l -d -vvv server -a 0.0.0.0:8080 templateIf you need to pass the module's arguments (sys.argv):
python -m reccd -l -d -vvv server -a 0.0.0.0:8080 template {argv1} {argv2} ... {argvN}Communicates with the daemon server:
python -m reccd -l -d -vvv client -a 0.0.0.0:8080 -m post -p /echo messageThe default module prefix is reccd_. If you want to change it, you can use the --module-prefix flag.
./python -m reccd --module-prefix 'my_prefix_' modulesCreate a project so that the package name starts with reccd_.
All specifications must be implemented in an __init__.py file at the root of the module.
Add the module's version. Must follow the SemVer specification.
__version__ = "0.0.0"Add documentation explaining how to use the module.
__doc__ = """
Usage: module {arg0} {arg1}
...
"""Implement the module's initialization event.
Command line arguments passed to the module can be accessed as sys.argv.
async def on_open() -> None:
passImplement the module's shutdown event.
async def on_close() -> None:
passCreated to identify clients that will communicate with the module.
Arguments depend on the client implementation.
Returns 0 if registered successfully.
async def on_register(*args, **kwargs) -> int:
return 0Check out test file.
async def get_test():
pass
async def post_test():
pass
def on_routes():
return [
("GET", "/test", get_test),
("POST", "/test", post_test),
]See the LICENSE file for details. In summary, reccd is licensed under the MIT license.