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)
Release files for bws-jsonrpc 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bws-jsonrpc-0.0.3.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bws_jsonrpc-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.9 kB
Release files / bws-jsonrpc-0.0.3.tar.gz
| Download URL | bws-jsonrpc-0.0.3.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
daf18955bca91ee788be32ef805239b3bd7d4e05519bbb6e962783817699ea99
|
|
BLAKE2b-256 checksum How to use checksums |
c6cd46ea881a94163dcac8209fa694e326b5cf8a475d99679221e74c013ff11e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.26.0
|
Release files / bws_jsonrpc-0.0.3-py3-none-any.whl
| Download URL | bws_jsonrpc-0.0.3-py3-none-any.whl |
|---|---|
| Size | 2.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f33dbaa29bd5809eb35df9d94bc18f975f67d389618a58f50bc3d10e5bd5ae8f
|
|
BLAKE2b-256 checksum How to use checksums |
cd0b1a6e39c97b808f92bab9214a13edcdd1a49015aa39219915fb2fc3e3c704
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.26.0
|