jsonrpc implementation for tornado
Project description
JSON RPC implementation for tornado
This implementation follow JSONRPC 2.0 specification.
REQUIREMENTS
python >= 3.5 (async/await is used in the package)
INSTALLATION
pip install tornado_jsonrpc
USAGE
It is so simple:
-
Just create
views.pydef 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) -
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() -
You can also use CORSIgnoreJSONRPCHandler to receive requests from all sources or WithCredentialsJSONRPCHandler to also receive cookies with request.
CONTRIBUTE
If You have found an error or want to offer 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 Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tornado_jsonrpc-1.0.5-py2.py3-none-any.whl.
File metadata
- Download URL: tornado_jsonrpc-1.0.5-py2.py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c29191444bd0752e79e48f8b96caf02b99feb6d0ac9858c6d44fc0ffd38021ec
|
|
| MD5 |
76f160541de24c1bb2f322053febc6a8
|
|
| BLAKE2b-256 |
cf601466035c870c2f0dea9418abaa090d25e5715e4a358d22f6a45f0062e449
|