{ "info": { "author": "Joe Gasewicz", "author_email": "joegasewicz@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Operating System :: OS Independent", "Programming Language :: Python :: 3.7" ], "description": "[![PyPI version](https://badge.fury.io/py/flask-jwt-router.svg)](https://badge.fury.io/py/flask-jwt-router)\n\n\n# Flask JWT Router\n\nFlask JWT Router is a Python library that adds authorised routes to a Flask app.\n\nRead the Documentation here: [Flask-JWT-Router](https://flask-jwt-router.readthedocs.io/en/latest/) \n\n## Installation\n\n```bash\npip install flask-jwt-router\n```\n\n## Basic Usage\n ```python\nfrom flask import Flask\nfrom flask_jwt_router import JwtRoutes\n\napp = Flask(__name__)\n\nJwtRoutes(app)\n\n```\n\n## White list Routes\n```python\napp.config[\"WHITE_LIST_ROUTES\"] = [\n (\"POST\", \"/register\"),\n]\n\n@app.route(\"/register\", methods=[\"POST\"])\ndef register():\n return \"I don't need authorizing!\"\n```\n\n## Declare an entity model\n```python\n# Create your entity model (example uses Flask-SqlAlchemy)\nclass UserModel(db.Model):\n id = db.Column(db.Integer, primary_key=True)\n name = db.Column(db.String)\n# You can define the primary key name with `ENTITY_KEY` on Flask's config\napp.config[\"ENTITY_KEY\"] = \"user_id\"\n# (`id` is used by default)\nJwtRoutes(app, entity_model=UserModel)\n\n```\n\n## Authorization\n```python\nfrom flask_jwt_router import RouteHelpers\nrh = RouteHelpers(app)\n\n# white list the routes\napp.config[\"WHITE_LIST_ROUTES\"] = [\n (\"POST\", \"/register\"),\n (\"POST\", \"/login\"),\n]\n\n@app.route(\"/register\", methods=[\"POST\"])\ndef register():\n \"\"\"I'm registering a new user & returning a token!\"\"\"\n return jsonify({\n \"token\": rh.register_entity(entity_id=1)\n })\n\n@app.route(\"/login\", methods=[\"POST\"])\ndef login():\n \"\"\"I'm authorized & updating my token!\"\"\"\n return jsonify({\n \"token\": rh.update_entity(entity_id=1)\n })\n```\n\n# Access entity on Flask's global context\n```python\n# Example uses Marshmallow to serialize entity object\nclass EntitySchema(Schema):\n id = fields.Integer()\n name = fields.String()\n\n@app.route(\"/user\", methods=[\"GET\"])\ndef get_user():\n \"\"\"I was authorized & i have a user!\"\"\"\n entity = EntitySchema().dumps(g.entity).data\n return jsonify({\n \"entity\": entity\n })\n\n```\n\n## Authors\n\n* **joegasewicz** - *Initial work* - [@joegasewicz](https://twitter.com/joegasewicz)\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/joegasewicz/Flask-JWT-Router", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "flask-jwt-router", "package_url": "https://pypi.org/project/flask-jwt-router/", "platform": "", "project_url": "https://pypi.org/project/flask-jwt-router/", "project_urls": { "Homepage": "https://github.com/joegasewicz/Flask-JWT-Router" }, "release_url": "https://pypi.org/project/flask-jwt-router/0.0.4/", "requires_dist": null, "requires_python": "", "summary": "Flask JWT Router is a Python library that adds authorised routes to a Flask app", "version": "0.0.4" }, "last_serial": 5474379, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "6e99c66af5c24caa453fcb36034ac00b", "sha256": "0febbe2666d9360af57a28d2a4bf381bbd6496428952c32b998bd617c6ae6aae" }, "downloads": -1, "filename": "flask_jwt_router-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "6e99c66af5c24caa453fcb36034ac00b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17833, "upload_time": "2019-06-09T16:00:58", "url": "https://files.pythonhosted.org/packages/e1/d4/5a4831cfabc2075b537bdabdb277a81697970e2b91b1106041720b0d775e/flask_jwt_router-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4f31dbfe8991566b3cf668555f80c9b9", "sha256": "4eff9af9f46685c42260dcfbcd4e9922784392bded286a0127b32dbd317d9f49" }, "downloads": -1, "filename": "flask-jwt-router-0.0.1.tar.gz", "has_sig": false, "md5_digest": "4f31dbfe8991566b3cf668555f80c9b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25092, "upload_time": "2019-06-09T16:01:01", "url": "https://files.pythonhosted.org/packages/cc/b7/676208c4543ea4eacdefb3b5a43793b69363fafbdc14dbad101f4e8628ec/flask-jwt-router-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "e2ddb6be3bd868d4bb53a056a4e4532f", "sha256": "9f2629df9aa878a8b2619f78d11561763705c41cae0132b9be3235a1ca0b4f98" }, "downloads": -1, "filename": "flask_jwt_router-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "e2ddb6be3bd868d4bb53a056a4e4532f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17833, "upload_time": "2019-06-09T16:22:15", "url": "https://files.pythonhosted.org/packages/bb/88/0002c7bd0de37b59c3d667ca40a9b0b0068ed42f747e317f23d21fd3093e/flask_jwt_router-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c36eeb7e3dacdb26757ed21c3c3b9688", "sha256": "f77e555cae029a5dc00d413fd9b4b79acb09c5bb74e7f16cef46c69818e24529" }, "downloads": -1, "filename": "flask-jwt-router-0.0.2.tar.gz", "has_sig": false, "md5_digest": "c36eeb7e3dacdb26757ed21c3c3b9688", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25888, "upload_time": "2019-06-09T16:22:17", "url": "https://files.pythonhosted.org/packages/e2/c8/481da1ad970241dcbdae049994edf6ef5783a8a468688834ce7fbef5ae4f/flask-jwt-router-0.0.2.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "212c96c502469a430218721eda1f3c2f", "sha256": "7021cb6aaab4c3893d4b33e0a3409ece08570ef2159d490ebd6595fdafc547d7" }, "downloads": -1, "filename": "flask_jwt_router-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "212c96c502469a430218721eda1f3c2f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17885, "upload_time": "2019-07-02T00:03:57", "url": "https://files.pythonhosted.org/packages/b8/31/ac3e7d14c9d77e21f325187c4ec906ecc45a47c725ae934bad76f653d19b/flask_jwt_router-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "245b99faf088dc0061ec0792fd90467d", "sha256": "76b5788ebc26e8099122f0e35212149142bb87f634cf47b3eed9bcec20fc2c80" }, "downloads": -1, "filename": "flask-jwt-router-0.0.4.tar.gz", "has_sig": false, "md5_digest": "245b99faf088dc0061ec0792fd90467d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25897, "upload_time": "2019-07-02T00:03:59", "url": "https://files.pythonhosted.org/packages/5a/1e/6598716d9c6f0f99ef4bf2c990b79c4e3a812115ccc25ccf2781b71d2812/flask-jwt-router-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "212c96c502469a430218721eda1f3c2f", "sha256": "7021cb6aaab4c3893d4b33e0a3409ece08570ef2159d490ebd6595fdafc547d7" }, "downloads": -1, "filename": "flask_jwt_router-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "212c96c502469a430218721eda1f3c2f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17885, "upload_time": "2019-07-02T00:03:57", "url": "https://files.pythonhosted.org/packages/b8/31/ac3e7d14c9d77e21f325187c4ec906ecc45a47c725ae934bad76f653d19b/flask_jwt_router-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "245b99faf088dc0061ec0792fd90467d", "sha256": "76b5788ebc26e8099122f0e35212149142bb87f634cf47b3eed9bcec20fc2c80" }, "downloads": -1, "filename": "flask-jwt-router-0.0.4.tar.gz", "has_sig": false, "md5_digest": "245b99faf088dc0061ec0792fd90467d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25897, "upload_time": "2019-07-02T00:03:59", "url": "https://files.pythonhosted.org/packages/5a/1e/6598716d9c6f0f99ef4bf2c990b79c4e3a812115ccc25ccf2781b71d2812/flask-jwt-router-0.0.4.tar.gz" } ] }