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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file bws-jsonrpc-0.0.3.tar.gz.

File metadata

  • Download URL: bws-jsonrpc-0.0.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.26.0

File hashes

Hashes for bws-jsonrpc-0.0.3.tar.gz
Algorithm Hash digest
SHA256 daf18955bca91ee788be32ef805239b3bd7d4e05519bbb6e962783817699ea99
MD5 46f564ac68afa20d0df133c6513a0b21
BLAKE2b-256 c6cd46ea881a94163dcac8209fa694e326b5cf8a475d99679221e74c013ff11e

See more details on using hashes here.

File details

Details for the file bws_jsonrpc-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: bws_jsonrpc-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.26.0

File hashes

Hashes for bws_jsonrpc-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f33dbaa29bd5809eb35df9d94bc18f975f67d389618a58f50bc3d10e5bd5ae8f
MD5 1bc481d59cb88d0cc3b60dbae554185f
BLAKE2b-256 cd0b1a6e39c97b808f92bab9214a13edcdd1a49015aa39219915fb2fc3e3c704

See more details on using hashes here.

Supported by

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