A Python server implementaion of JSON-RPC 2.0 over HTTP
Project description
Rufmich
A Python server implementaion of JSON-RPC 2.0 over HTTP.
Introduction
rufmich implements the JSON-RPC 2.0 specification with a few minor changes:
- The transport protocol is HTTP.
- A notification request will get an immediate response. Usually the server will start the procedure and return the response immediately (without having to wait for the procedure to finish). And there is no callback for the procedure, which means the client would not be aware of any errors.
- Method namespacing is supported (and recommended to be used).
User Guide
Installation
pip install rufmich
Define methods
Create a folder with following structure:
- <your_methods_workspace>
- root
root.py
- <A>
<A.py>
- <B>
<B.py>
- <C>
<C.py>
An example is:
- my_methods
- root
root.py
- registration
registration.py
- by_email
by_email.py
Note that there MUST BE a directory named root under your workspace folder.
Each namespace folder MUST HAVE a .py
file with the same name as the folder. The methods defined in those .py
files will be indexed according to the folder hierarchy.
Examples:
- A method
foobar
defined inroot.py
is indexed to"foobar"
and"::foobar"
- A method
send_code_to_email
defined inby_email.py
in the above example is indexed to"registration::by_email::send_code_to_email"
(and"::registration::by_email::send_code_to_email"
)
Run
from rufmich.server import RMServer
server = RMServer(load_path=<your_methods_workspace>)
server.run(port=<port>)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rufmich-0.1.0.tar.gz
(3.1 kB
view hashes)
Built Distribution
rufmich-0.1.0-py3-none-any.whl
(16.3 kB
view hashes)