Adds JSONRPC support to Flask.
Project description
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 version.
- Support Python 3.8 or later.
- Experimental support to Mypyc, it compiles Python modules to C extensions.
- The web browsable API.
- Run-time type checking functions defined with PEP 484 argument (and return) type annotations.
- Extensive documentation, and great community support.
There is a live example API for testing purposes, available here.
Below: Screenshot from the browsable API
Adding Flask JSON-RPC to your application
- Installation
$ pip install Flask-JSONRPC
or
$ git clone git://github.com/cenobites/flask-jsonrpc.git
$ cd flask-jsonrpc
$ python setup.py install
- 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.
@jsonrpc.method("App.index")
def index() -> str:
return "Welcome to Flask JSON-RPC"
All code of example run.py.
- Running
$ python run.py
* Running on http://0.0.0.0:5000/
- 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
Project details
Release history Release notifications | RSS feed
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-3.0.1.tar.gz
(762.7 kB
view hashes)
Built Distributions
Close
Hashes for Flask_JSONRPC-3.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7836fecbd4ff96c4e4cd1f1f8a56553f4f7452598c0ec652ad74f8ab75221e69 |
|
MD5 | ced2f858f8698e9d7037b1ac27089b99 |
|
BLAKE2b-256 | 2f1f51a5cf258fc59ee0b56483c0e467f8d07c3f4ca84fbae725d72669a5a038 |
Close
Hashes for Flask_JSONRPC-3.0.1-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 608b132335087e8cf39ebeaf3aa1da7cf78ad5b14dd2a35470f2469b098d3cfb |
|
MD5 | feea185a5f1a16851f5cc52f81d3e863 |
|
BLAKE2b-256 | 860ee19de8ee08fffb3ea3bc4059190a452a79722bd1be2860aeb96d32f66661 |
Close
Hashes for Flask_JSONRPC-3.0.1-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0742038ebbe54d6334ad7fc681fa44f2e560e5f08e24bd60c42e74d8ceafec4 |
|
MD5 | 710e34a144b10319154989e3c66fbdba |
|
BLAKE2b-256 | 81ca610c039890eb2925a8f2ac35e21cc6b393cdc13d4c25d60f444c6e0a9c43 |
Close
Hashes for Flask_JSONRPC-3.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4704ad191fb4ca070d0c1cdb792fa99bc94c6afdf163a311704f6e6f4c381f7d |
|
MD5 | 804e3b838ab9798c2f2a2706270de1a8 |
|
BLAKE2b-256 | 75441a559dc8d084fd4a32da94b574455ec36ea4d1001e56e9f452b30e007f15 |
Close
Hashes for Flask_JSONRPC-3.0.1-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 901e9f76b5bd21b6700e38b1a71fa3c15f3ed2cfd9ae52f9dfb09dbddade3fca |
|
MD5 | 09a54f965d73be0899d2c89164376c2b |
|
BLAKE2b-256 | 64ad6aa27c823fb9aa7d5bf496134a843004ea2b4d840ca78a352063c50fca24 |
Close
Hashes for Flask_JSONRPC-3.0.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eab7b53319731ca2e590714f6dfbcff39fa2cf318642c1e7ab41db865aa324b0 |
|
MD5 | 873dc2ffe558eddcaa57584ba05234df |
|
BLAKE2b-256 | d4fab4dab576f79da7f7fe4c159b2641f937cb423b15ba0a943639d390abc83f |
Close
Hashes for Flask_JSONRPC-3.0.1-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6c7a291a5fa13a2ce33364bf9952e0c99025085fde9074a1df7e75cfeddf244 |
|
MD5 | 9a23c4bbef82fd85bb11f9264fc51fbf |
|
BLAKE2b-256 | b8be377cfd6b5a8369616ed4cd2a92a533586f2b45f0f2a9c28469f10a3cddb6 |
Close
Hashes for Flask_JSONRPC-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b17d3813b84f59784be8772d778521f5a8127925ad8ecf3235fe548a8ff3d455 |
|
MD5 | acdb4c90a7c745123ca710d4534e6041 |
|
BLAKE2b-256 | 73514db0abcda8b2b859d41510eeecb419cbdc3d5a7e749b1f0b841905f464fd |
Close
Hashes for Flask_JSONRPC-3.0.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78544a788930f7b2c84a3d1da724ca2037e1e6aaad2f4868b4a00fbc0e69b301 |
|
MD5 | fc4d0a58b42252645a849406d516353f |
|
BLAKE2b-256 | a9c95587c088bbf731068596658c520482d2a894097863e05623900cb6f17efb |