jsonrpc implementation for tornado
Project description
JSON RPC implementation for tornado
===================================
This implementation follow JSONRPC 2.0 specification.
REQUIREMENTS
------------
python >= 3.5 (I use async/await in the package)
INSTALLATION
------------
pip install tornado_jsonrpc
USAGE
-----
It is so simple:
1. Just create `views.py`
def some_view(request: RequestHandler, *args, **kwargs): #
"""
args: positional params, which You pass when call jsonrpc method
kwargs: named params, which You pass when call jsonrpc method
"""
return {'foo': 'bar'} # any JSON serializable object (dict or list for example)
2. And then create `tornado_app.py`, where You define tornado Application:
from tornado_jsonrpc import JSONRPCHandler
from tornado.ioloop import IOLoop
from tornado.web import Application
from your_package import views
Application(
[
('/api', views.JSONRPCHandler, dict(views=views)),
],
).listen(8888)
IOLoop.current().start()
CONTRIBUTE
----------
If You have found an error or want to offer some changes - create a pull request and I will review it as soon as possible!
===================================
This implementation follow JSONRPC 2.0 specification.
REQUIREMENTS
------------
python >= 3.5 (I use async/await in the package)
INSTALLATION
------------
pip install tornado_jsonrpc
USAGE
-----
It is so simple:
1. Just create `views.py`
def some_view(request: RequestHandler, *args, **kwargs): #
"""
args: positional params, which You pass when call jsonrpc method
kwargs: named params, which You pass when call jsonrpc method
"""
return {'foo': 'bar'} # any JSON serializable object (dict or list for example)
2. And then create `tornado_app.py`, where You define tornado Application:
from tornado_jsonrpc import JSONRPCHandler
from tornado.ioloop import IOLoop
from tornado.web import Application
from your_package import views
Application(
[
('/api', views.JSONRPCHandler, dict(views=views)),
],
).listen(8888)
IOLoop.current().start()
CONTRIBUTE
----------
If You have found an error or want to offer some changes - create a pull request and I will review it as soon as possible!
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
tornado_jsonrpc-1.0.3.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for tornado_jsonrpc-1.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62db6ae6dd1468798337fa6f0a6f886fbf2d2b41b4b8baa93f601874f463e480 |
|
MD5 | 8d8e1698ab7fa0981f35c7595abfbf46 |
|
BLAKE2b-256 | d774636371436522ff8a9d9ad0b1431ab94906ec4a82f433552af62c8183c734 |