Flask-JSONRPC


NameFlask-JSONRPC JSON
Version 3.0.1 PyPI version JSON
download
home_page
SummaryAdds JSONRPC support to Flask.
upload_time2024-02-11 21:36:54
maintainer
docs_urlhttps://pythonhosted.org/Flask-JSONRPC/
author
requires_python>=3.8
licenseCopyright (c) 2012-2022, Cenobit Technologies, Inc. http://cenobit.es/ All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Cenobit Technologies, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords flask flask-extensions jsonrpc
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![Release Status](https://github.com/cenobites/flask-jsonrpc/actions/workflows/release.yml/badge.svg)
![Tests Status](https://github.com/cenobites/flask-jsonrpc/actions/workflows/tests.yml/badge.svg?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/cenobites/flask-jsonrpc/badge.svg?branch=master)](https://coveralls.io/github/cenobites/flask-jsonrpc?branch=master)
[![Documentation Status](https://readthedocs.org/projects/flask-jsonrpc/badge/?version=latest)](https://flask-jsonrpc.readthedocs.io/en/latest/?badge=latest)
# 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](https://www.jsonrpc.org/specification "JSON-RPC 2.0") version.
* Support Python 3.8 or later.
* Experimental support to [Mypyc](https://mypyc.readthedocs.io/en/latest/introduction.html), it compiles Python modules to C extensions.
* The web browsable API.
* Run-time type checking functions defined with [PEP 484](https://www.python.org/dev/peps/pep-0484/ "PEP 484") argument (and return) type annotations.
* Extensive documentation, and great community support.

There is a live example API for testing purposes, [available here](http://flask-jsonrpc.herokuapp.com/api/browse "Web browsable API").

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

![Web browsable API](https://f.cloud.github.com/assets/298350/1575590/203c595a-5150-11e3-99a0-4a6fd9bcbe52.png "Web browsable API")

### Adding Flask JSON-RPC to your application

1. Installation

```console
$ pip install Flask-JSONRPC
```

or

```console
$ git clone git://github.com/cenobites/flask-jsonrpc.git
$ cd flask-jsonrpc
$ python setup.py install
```


2. Getting Started

Create your application and initialize the Flask-JSONRPC.

```python
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.

```python
@jsonrpc.method("App.index")
def index() -> str:
    return "Welcome to Flask JSON-RPC"
```

All code of example [run.py](https://github.com/cenobites/flask-jsonrpc/blob/master/run.py).


3. Running

```console
$ python run.py
 * Running on http://0.0.0.0:5000/
```

4. Testing

```console
$ 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

* [http://docs.python.org/](http://docs.python.org/)
* [https://flask.palletsprojects.com/](https://flask.palletsprojects.com/)
* [http://www.jsonrpc.org/](http://www.jsonrpc.org/)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "Flask-JSONRPC",
    "maintainer": "",
    "docs_url": "https://pythonhosted.org/Flask-JSONRPC/",
    "requires_python": ">=3.8",
    "maintainer_email": "\"Cenobit Technologies Inc.\" <hi@cenobit.es>",
    "keywords": "flask,flask-extensions,jsonrpc",
    "author": "",
    "author_email": "Nycholas Oliveira <nycholas@cenobit.es>",
    "download_url": "https://files.pythonhosted.org/packages/7e/9d/637a0620802e4c496bd5d48e3766c3a4fd6a03f815f9bcb183bc7a17a5bb/Flask-JSONRPC-3.0.1.tar.gz",
    "platform": null,
    "description": "![Release Status](https://github.com/cenobites/flask-jsonrpc/actions/workflows/release.yml/badge.svg)\n![Tests Status](https://github.com/cenobites/flask-jsonrpc/actions/workflows/tests.yml/badge.svg?branch=master)\n[![Coverage Status](https://coveralls.io/repos/github/cenobites/flask-jsonrpc/badge.svg?branch=master)](https://coveralls.io/github/cenobites/flask-jsonrpc?branch=master)\n[![Documentation Status](https://readthedocs.org/projects/flask-jsonrpc/badge/?version=latest)](https://flask-jsonrpc.readthedocs.io/en/latest/?badge=latest)\n# Flask JSON-RPC\n\nBasic JSON-RPC implementation for your Flask-powered sites.\n\nSome reasons you might want to use:\n\n* Simple, powerful, flexible, and pythonic API.\n* Support [JSON-RPC 2.0](https://www.jsonrpc.org/specification \"JSON-RPC 2.0\") version.\n* Support Python 3.8 or later.\n* Experimental support to [Mypyc](https://mypyc.readthedocs.io/en/latest/introduction.html), it compiles Python modules to C extensions.\n* The web browsable API.\n* Run-time type checking functions defined with [PEP 484](https://www.python.org/dev/peps/pep-0484/ \"PEP 484\") argument (and return) type annotations.\n* Extensive documentation, and great community support.\n\nThere is a live example API for testing purposes, [available here](http://flask-jsonrpc.herokuapp.com/api/browse \"Web browsable API\").\n\n**Below:** *Screenshot from the browsable API*\n\n![Web browsable API](https://f.cloud.github.com/assets/298350/1575590/203c595a-5150-11e3-99a0-4a6fd9bcbe52.png \"Web browsable API\")\n\n### Adding Flask JSON-RPC to your application\n\n1. Installation\n\n```console\n$ pip install Flask-JSONRPC\n```\n\nor\n\n```console\n$ git clone git://github.com/cenobites/flask-jsonrpc.git\n$ cd flask-jsonrpc\n$ python setup.py install\n```\n\n\n2. Getting Started\n\nCreate your application and initialize the Flask-JSONRPC.\n\n```python\nfrom flask import Flask\nfrom flask_jsonrpc import JSONRPC\n\napp = Flask(\"application\")\njsonrpc = JSONRPC(app, \"/api\", enable_web_browsable_api=True)\n```\n\nWrite JSON-RPC methods.\n\n```python\n@jsonrpc.method(\"App.index\")\ndef index() -> str:\n    return \"Welcome to Flask JSON-RPC\"\n```\n\nAll code of example [run.py](https://github.com/cenobites/flask-jsonrpc/blob/master/run.py).\n\n\n3. Running\n\n```console\n$ python run.py\n * Running on http://0.0.0.0:5000/\n```\n\n4. Testing\n\n```console\n$ curl -i -X POST \\\n   -H \"Content-Type: application/json; indent=4\" \\\n   -d '{\n    \"jsonrpc\": \"2.0\",\n    \"method\": \"App.index\",\n    \"params\": {},\n    \"id\": \"1\"\n}' http://localhost:5000/api\n\nHTTP/1.0 200 OK\nContent-Type: application/json\nContent-Length: 77\nServer: Werkzeug/0.8.3 Python/2.7.3\nDate: Fri, 14 Dec 2012 19:26:56 GMT\n\n{\n  \"jsonrpc\": \"2.0\",\n  \"id\": \"1\",\n  \"result\": \"Welcome to Flask JSON-RPC\"\n}\n```\n\n\n### References\n\n* [http://docs.python.org/](http://docs.python.org/)\n* [https://flask.palletsprojects.com/](https://flask.palletsprojects.com/)\n* [http://www.jsonrpc.org/](http://www.jsonrpc.org/)\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2012-2022, Cenobit Technologies, Inc. http://cenobit.es/ All rights reserved.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Cenobit Technologies, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
    "summary": "Adds JSONRPC support to Flask.",
    "version": "3.0.1",
    "project_urls": {
        "Documentation": "https://flask-jsonrpc.readthedocs.io/",
        "Donate": "https://github.com/sponsors/nycholas",
        "Issue Tracker": "https://github.com/cenobites/flask-jsonrpc/issues/",
        "Source Code": "https://github.com/cenobites/flask-jsonrpc",
        "Website": "https://flask-jsonrpc.readthedocs.io/"
    },
    "split_keywords": [
        "flask",
        "flask-extensions",
        "jsonrpc"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a9c95587c088bbf731068596658c520482d2a894097863e05623900cb6f17efb",
                "md5": "fc4d0a58b42252645a849406d516353f",
                "sha256": "78544a788930f7b2c84a3d1da724ca2037e1e6aaad2f4868b4a00fbc0e69b301"
            },
            "downloads": -1,
            "filename": "Flask_JSONRPC-3.0.1-cp311-cp311-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "fc4d0a58b42252645a849406d516353f",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 917883,
            "upload_time": "2024-02-11T21:36:41",
            "upload_time_iso_8601": "2024-02-11T21:36:41.806068Z",
            "url": "https://files.pythonhosted.org/packages/a9/c9/5587c088bbf731068596658c520482d2a894097863e05623900cb6f17efb/Flask_JSONRPC-3.0.1-cp311-cp311-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "73514db0abcda8b2b859d41510eeecb419cbdc3d5a7e749b1f0b841905f464fd",
                "md5": "acdb4c90a7c745123ca710d4534e6041",
                "sha256": "b17d3813b84f59784be8772d778521f5a8127925ad8ecf3235fe548a8ff3d455"
            },
            "downloads": -1,
            "filename": "Flask_JSONRPC-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "acdb4c90a7c745123ca710d4534e6041",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 1048125,
            "upload_time": "2024-02-11T21:36:43",
            "upload_time_iso_8601": "2024-02-11T21:36:43.869044Z",
            "url": "https://files.pythonhosted.org/packages/73/51/4db0abcda8b2b859d41510eeecb419cbdc3d5a7e749b1f0b841905f464fd/Flask_JSONRPC-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b8be377cfd6b5a8369616ed4cd2a92a533586f2b45f0f2a9c28469f10a3cddb6",
                "md5": "9a23c4bbef82fd85bb11f9264fc51fbf",
                "sha256": "d6c7a291a5fa13a2ce33364bf9952e0c99025085fde9074a1df7e75cfeddf244"
            },
            "downloads": -1,
            "filename": "Flask_JSONRPC-3.0.1-cp311-cp311-musllinux_1_1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "9a23c4bbef82fd85bb11f9264fc51fbf",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 1042817,
            "upload_time": "2024-02-11T21:36:45",
            "upload_time_iso_8601": "2024-02-11T21:36:45.171591Z",
            "url": "https://files.pythonhosted.org/packages/b8/be/377cfd6b5a8369616ed4cd2a92a533586f2b45f0f2a9c28469f10a3cddb6/Flask_JSONRPC-3.0.1-cp311-cp311-musllinux_1_1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d4fab4dab576f79da7f7fe4c159b2641f937cb423b15ba0a943639d390abc83f",
                "md5": "873dc2ffe558eddcaa57584ba05234df",
                "sha256": "eab7b53319731ca2e590714f6dfbcff39fa2cf318642c1e7ab41db865aa324b0"
            },
            "downloads": -1,
            "filename": "Flask_JSONRPC-3.0.1-cp311-cp311-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "873dc2ffe558eddcaa57584ba05234df",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 918747,
            "upload_time": "2024-02-11T21:36:46",
            "upload_time_iso_8601": "2024-02-11T21:36:46.562782Z",
            "url": "https://files.pythonhosted.org/packages/d4/fa/b4dab576f79da7f7fe4c159b2641f937cb423b15ba0a943639d390abc83f/Flask_JSONRPC-3.0.1-cp311-cp311-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "64ad6aa27c823fb9aa7d5bf496134a843004ea2b4d840ca78a352063c50fca24",
                "md5": "09a54f965d73be0899d2c89164376c2b",
                "sha256": "901e9f76b5bd21b6700e38b1a71fa3c15f3ed2cfd9ae52f9dfb09dbddade3fca"
            },
            "downloads": -1,
            "filename": "Flask_JSONRPC-3.0.1-cp312-cp312-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "09a54f965d73be0899d2c89164376c2b",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.8",
            "size": 920179,
            "upload_time": "2024-02-11T21:36:47",
            "upload_time_iso_8601": "2024-02-11T21:36:47.875618Z",
            "url": "https://files.pythonhosted.org/packages/64/ad/6aa27c823fb9aa7d5bf496134a843004ea2b4d840ca78a352063c50fca24/Flask_JSONRPC-3.0.1-cp312-cp312-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "75441a559dc8d084fd4a32da94b574455ec36ea4d1001e56e9f452b30e007f15",
                "md5": "804e3b838ab9798c2f2a2706270de1a8",
                "sha256": "4704ad191fb4ca070d0c1cdb792fa99bc94c6afdf163a311704f6e6f4c381f7d"
            },
            "downloads": -1,
            "filename": "Flask_JSONRPC-3.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "804e3b838ab9798c2f2a2706270de1a8",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.8",
            "size": 1057678,
            "upload_time": "2024-02-11T21:36:49",
            "upload_time_iso_8601": "2024-02-11T21:36:49.344818Z",
            "url": "https://files.pythonhosted.org/packages/75/44/1a559dc8d084fd4a32da94b574455ec36ea4d1001e56e9f452b30e007f15/Flask_JSONRPC-3.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "81ca610c039890eb2925a8f2ac35e21cc6b393cdc13d4c25d60f444c6e0a9c43",
                "md5": "710e34a144b10319154989e3c66fbdba",
                "sha256": "c0742038ebbe54d6334ad7fc681fa44f2e560e5f08e24bd60c42e74d8ceafec4"
            },
            "downloads": -1,
            "filename": "Flask_JSONRPC-3.0.1-cp312-cp312-musllinux_1_1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "710e34a144b10319154989e3c66fbdba",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.8",
            "size": 1051663,
            "upload_time": "2024-02-11T21:36:50",
            "upload_time_iso_8601": "2024-02-11T21:36:50.807397Z",
            "url": "https://files.pythonhosted.org/packages/81/ca/610c039890eb2925a8f2ac35e21cc6b393cdc13d4c25d60f444c6e0a9c43/Flask_JSONRPC-3.0.1-cp312-cp312-musllinux_1_1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "860ee19de8ee08fffb3ea3bc4059190a452a79722bd1be2860aeb96d32f66661",
                "md5": "feea185a5f1a16851f5cc52f81d3e863",
                "sha256": "608b132335087e8cf39ebeaf3aa1da7cf78ad5b14dd2a35470f2469b098d3cfb"
            },
            "downloads": -1,
            "filename": "Flask_JSONRPC-3.0.1-cp312-cp312-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "feea185a5f1a16851f5cc52f81d3e863",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.8",
            "size": 919873,
            "upload_time": "2024-02-11T21:36:52",
            "upload_time_iso_8601": "2024-02-11T21:36:52.106307Z",
            "url": "https://files.pythonhosted.org/packages/86/0e/e19de8ee08fffb3ea3bc4059190a452a79722bd1be2860aeb96d32f66661/Flask_JSONRPC-3.0.1-cp312-cp312-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2f1f51a5cf258fc59ee0b56483c0e467f8d07c3f4ca84fbae725d72669a5a038",
                "md5": "ced2f858f8698e9d7037b1ac27089b99",
                "sha256": "7836fecbd4ff96c4e4cd1f1f8a56553f4f7452598c0ec652ad74f8ab75221e69"
            },
            "downloads": -1,
            "filename": "Flask_JSONRPC-3.0.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ced2f858f8698e9d7037b1ac27089b99",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.8",
            "size": 759556,
            "upload_time": "2024-02-11T21:36:53",
            "upload_time_iso_8601": "2024-02-11T21:36:53.636506Z",
            "url": "https://files.pythonhosted.org/packages/2f/1f/51a5cf258fc59ee0b56483c0e467f8d07c3f4ca84fbae725d72669a5a038/Flask_JSONRPC-3.0.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7e9d637a0620802e4c496bd5d48e3766c3a4fd6a03f815f9bcb183bc7a17a5bb",
                "md5": "29ca67027f53912cb146d9305ea3e810",
                "sha256": "110295be39c6d6a110063630c050e3f8a4f79c50281898b3f1cb8a18fb3cb84a"
            },
            "downloads": -1,
            "filename": "Flask-JSONRPC-3.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "29ca67027f53912cb146d9305ea3e810",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 762741,
            "upload_time": "2024-02-11T21:36:54",
            "upload_time_iso_8601": "2024-02-11T21:36:54.921302Z",
            "url": "https://files.pythonhosted.org/packages/7e/9d/637a0620802e4c496bd5d48e3766c3a4fd6a03f815f9bcb183bc7a17a5bb/Flask-JSONRPC-3.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-11 21:36:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sponsors",
    "github_project": "nycholas",
    "github_not_found": true,
    "lcname": "flask-jsonrpc"
}
        
Elapsed time: 2.60039s