Bws JsonRpc
Project description
JsonRpc Flask Ext Dispatcher
Instalación
pip install bws-jsonrpc
Modo de uso
from flask import Flask
from bws_jsonrpc import rpc
@rpc.method
def ping() -> Result:
'''return pong'''
return rpc.Success("pong")
@rpc.method
def think(object, verb) -> Result:
return rpc.Success([verb, object])
g = rpc.group("actions")
@g.method(name="drink")
def _drink_(object, verb="drink") -> Result:
return rpc.Success([verb, object])
@rpc.expose_class(name="person")
class Person(object):
@rpc.expose_method
def greet(self, name=None):
'''
return Hi + name
'''
return rpc.Success("Hi {}".format(name or ""))
if __name__ == "__main__":
app = Flask(__name__)
app.register_blueprint(rpc.as_blueprint())
app.run(debug=True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bws-jsonrpc-0.0.2.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for bws_jsonrpc-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f7cb86b5fabbcdd1ba5d0929d51fbe3e9b93461b5ad0127f72f694e9b5c897c |
|
MD5 | e27eb87eb568ae46ac8e5141b0b1b516 |
|
BLAKE2b-256 | 09f520e2b9df5a5944a4f117c898fcae8f5431a36f27385da8e6ad1529b346bf |