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() -> rpc.Result:
'''return pong'''
return rpc.Success("pong")
@rpc.method
def think(object, verb) -> rpc.Result:
return rpc.Success([verb, object])
g = rpc.group("actions")
@g.method(name="drink")
def _drink_(object, verb="drink") -> rpc.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.3.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for bws_jsonrpc-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f33dbaa29bd5809eb35df9d94bc18f975f67d389618a58f50bc3d10e5bd5ae8f |
|
MD5 | 1bc481d59cb88d0cc3b60dbae554185f |
|
BLAKE2b-256 | cd0b1a6e39c97b808f92bab9214a13edcdd1a49015aa39219915fb2fc3e3c704 |