Skip to main content

JSON-RPC 2.0 server library for Python 3.

Project description

https://pypip.in/v/jsonrpcserver/badge.png https://pypip.in/d/jsonrpcserver/badge.png

Receive JSON-RPC requests in a Flask app.

Simply register the blueprint to your app, then add a route and write the methods to carry out the requests:

app = Flask(__name__)
app.register_blueprint(bp)

@app.route('/', methods=['POST'])
def index():
    return dispatch(request.get_json(), HandleRequests)

class HandleRequests:
    @staticmethod
    def add(x, y):
        return x + y

Installation

$ pip install jsonrpcserver

Documentation

Documentation is available at https://jsonrpcserver.readthedocs.org/.

If you need a client, try my jsonrpcclient library.

Release History

1.0.11 (2015-02-12)

  • Ability to log the http headers. See Logging.

1.0.10 (2014-12-31)

  • Important! The dispatch method now requires two arguments. Change dispatch(HandleRequests) to dispatch(flask.request.get_json(), HandleRequests). This gives you the freedom to customize the way flask retrieves the json request. For example, pass force=True to ignore the mimetype sent from the client. See get_json.

  • Blueprint error handling improved. Now gives certain errors, such as Internal Server Error, in the format requested by the client (in the Accept header).

1.0.9 (2014-12-31)

  • Bugfix: Fixed a critical bug where the blueprint wasn’t catching exceptions!

  • Logging has changed. See Logging.

1.0.8 (2014-12-30)

  • Bugfix: an important schema file wasn’t being included in the distribution.

1.0.7 (2014-12-30)

  • The dispatch module renamed to dispatcher, to avoid conflicting with the dispatch method.

1.0.6 (2014-12-11)

  • Improved blueprint, with correct http status code responses.

  • Gives more information when rejecting a request.

  • Major rebuild of the exceptions.

  • More stability with 100% code coverage in tests.

1.0.5 (2014-12-02)

  • Messages are now output on the INFO log level.

  • Show the status code in response log entries.

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

jsonrpcserver-1.0.11.tar.gz (7.3 kB view details)

Uploaded Source

File details

Details for the file jsonrpcserver-1.0.11.tar.gz.

File metadata

File hashes

Hashes for jsonrpcserver-1.0.11.tar.gz
Algorithm Hash digest
SHA256 ce9b59bbea1566ff057890f181efc3558886650b994f52e60ba230e8ce9bf65f
MD5 95c801030935684b9850d6f9a4cf102a
BLAKE2b-256 6a2a11e0bc0801790b242b340fdf164f6839a0087898aefc30490e7e50aa01b6

See more details on using hashes here.

Supported by

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