Tomek Wójcik
c75ea4ea9d
* `bthlabs-jsonrpc-aiohttp` v1.0.0 * `bthlabs-jsonrpc-core` v1.0.0 * `bthlabs-jsonrpc-django` v1.0.0
37 lines
665 B
ReStructuredText
37 lines
665 B
ReStructuredText
Overview
|
|
========
|
|
|
|
This section provides the general overview of the integration.
|
|
|
|
Installation
|
|
------------
|
|
|
|
.. code-block:: shell
|
|
|
|
$ pip install bthlabs_jsonrpc_aiohttp
|
|
|
|
Usage
|
|
-----
|
|
|
|
First, you'll need to add a JSONRPC view to your project's URLs:
|
|
|
|
.. code-block:: python
|
|
|
|
# app.py
|
|
app = web.Application()
|
|
|
|
app.add_routes([
|
|
web.post('/rpc', JSONRPCView()),
|
|
])
|
|
|
|
Then, you'll need to implement the RPC method modules:
|
|
|
|
.. code-block:: python
|
|
|
|
# your_app/rpc_methods.py
|
|
from bthlabs_jsonrpc_core import register_method
|
|
|
|
@register_method(name='hello')
|
|
async def hello(request, who='World'):
|
|
return f'Hello, {who}!'
|