Skip to main content

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


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)

Uploaded Source

Built Distribution

bws_jsonrpc-0.0.3-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page