Skip to main content

Adds JSONRPC support to Flask.

Project description

[![Build Status](](
[![Coverage Status](](
[![Documentation Status](](
# Flask JSON-RPC

Basic JSON-RPC implementation for your Flask-powered sites.

Some reasons you might want to use:

* Simple, powerful, flexible, and pythonic API.
* Support [JSON-RPC 2.0]( "JSON-RPC 2.0") version.
* Support python 3.6 or later.
* The web browsable API.
* Run-time type checking functions defined with [PEP 484]( "PEP 484") argument (and return) type annotations.
* Extensive documentation, and great community support.

There is a live example API for testing purposes, [available here]( "Web browsable API").

**Below:** *Screenshot from the browsable API*

![Web browsable API]( "Web browsable API")

### Adding Flask JSON-RPC to your application

1. Installation

$ pip install Flask-JSONRPC


$ git clone git://
$ cd flask-jsonrpc
$ python install

2. Getting Started

Create your application and initialize the Flask-JSONRPC.

from flask import Flask
from flask_jsonrpc import JSONRPC

app = Flask("application")
jsonrpc = JSONRPC(app, "/api", enable_web_browsable_api=True)

Write JSON-RPC methods.

def index() -> str:
return "Welcome to Flask JSON-RPC"

All code of example [](

3. Running

$ python
* Running on

4. Testing

$ curl -i -X POST \
-H "Content-Type: application/json; indent=4" \
-d '{
"jsonrpc": "2.0",
"method": "App.index",
"params": {},
"id": "1"
}' http://localhost:5000/api

HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 77
Server: Werkzeug/0.8.3 Python/2.7.3
Date: Fri, 14 Dec 2012 19:26:56 GMT

"jsonrpc": "2.0",
"id": "1",
"result": "Welcome to Flask JSON-RPC"

### References

* [](
* [](
* [](

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Flask-JSONRPC-2.2.2.tar.gz (740.8 kB view hashes)

Uploaded source

Built Distribution

Flask_JSONRPC-2.2.2-py3-none-any.whl (736.4 kB view hashes)

Uploaded py3

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