fourcats-flask


Namefourcats-flask JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/FourCats-Py/FourCats-Flask
SummaryA flask encapsulated based on personal habits for fast use.
upload_time2024-04-23 08:40:22
maintainerNone
docs_urlNone
authorShiWeiDong
requires_python>=3.8
licenseNone
keywords fourcats flask
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # `FourCats-Flask`

### Statement

 - `FourCats-Flask` is a module with personal habits based on `Flask` and `Flask-RESTX` encapsulation. The main purpose of encapsulation is to provide a more convenient initialization method for partners.

### Simple Example

#### Init Flask

- The encapsulated flask object package contains JSON serialization processing, which has overloaded the request function.

```python
from fourcats_flask import Flask

flask_app = Flask(__name__)

if __name__ == '__main__':
    flask_app.run(host="localhost", port=5051, debug=True)

```

#### Init All Plug-in

```python
from fourcats_flask import Api
from fourcats_flask import Flask, FlaskInit

flask_app = Flask(__name__)

api = Api(title="Flask Base", description="Flask Base Document", doc="/api/docs")

# create_all - Whether to create a data table through Flask-Sqlalchemy. The default is false.

FlaskInit.register_api(app=flask_app, api=api)
FlaskInit.register_hook(app=flask_app, api=api)
FlaskInit.register_config(configs=["<your_path>/setting"], app=flask_app)
FlaskInit.register_sqlalchemy(app=flask_app, create_all=True)

```

#### Use Token

```python
from fourcats_flask import Token

auth = Token(secret="secret", scheme="JWT", algorithm="H265", message="Authentication failed.")

# with permission
# Using this decorator, the method will be called to execute the corresponding permission processing after the token passes the verification.
@auth.verify_permission
def verify_permission(user):
    # do something
    _ = user
    pass


```

#### About better function

- [Flask](https://flask.palletsprojects.com/en/2.1.x/)
- [Flask-RESTX](https://flask-restx.readthedocs.io/en/latest/)

### Completion example

Please [click](./example/create_flask.py) to view the completed sample code.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/FourCats-Py/FourCats-Flask",
    "name": "fourcats-flask",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "fourcats, flask",
    "author": "ShiWeiDong",
    "author_email": "shiweidong1993@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/00/aa/8d7000a560c67fbfcd5ceb5d4fbdd1daf981f5dd9b028ef0ea0b0655c0c7/fourcats_flask-0.2.0.tar.gz",
    "platform": null,
    "description": "# `FourCats-Flask`\n\n### Statement\n\n - `FourCats-Flask` is a module with personal habits based on `Flask` and `Flask-RESTX` encapsulation. The main purpose of encapsulation is to provide a more convenient initialization method for partners.\n\n### Simple Example\n\n#### Init Flask\n\n- The encapsulated flask object package contains JSON serialization processing, which has overloaded the request function.\n\n```python\nfrom fourcats_flask import Flask\n\nflask_app = Flask(__name__)\n\nif __name__ == '__main__':\n    flask_app.run(host=\"localhost\", port=5051, debug=True)\n\n```\n\n#### Init All Plug-in\n\n```python\nfrom fourcats_flask import Api\nfrom fourcats_flask import Flask, FlaskInit\n\nflask_app = Flask(__name__)\n\napi = Api(title=\"Flask Base\", description=\"Flask Base Document\", doc=\"/api/docs\")\n\n# create_all - Whether to create a data table through Flask-Sqlalchemy. The default is false.\n\nFlaskInit.register_api(app=flask_app, api=api)\nFlaskInit.register_hook(app=flask_app, api=api)\nFlaskInit.register_config(configs=[\"<your_path>/setting\"], app=flask_app)\nFlaskInit.register_sqlalchemy(app=flask_app, create_all=True)\n\n```\n\n#### Use Token\n\n```python\nfrom fourcats_flask import Token\n\nauth = Token(secret=\"secret\", scheme=\"JWT\", algorithm=\"H265\", message=\"Authentication failed.\")\n\n# with permission\n# Using this decorator, the method will be called to execute the corresponding permission processing after the token passes the verification.\n@auth.verify_permission\ndef verify_permission(user):\n    # do something\n    _ = user\n    pass\n\n\n```\n\n#### About better function\n\n- [Flask](https://flask.palletsprojects.com/en/2.1.x/)\n- [Flask-RESTX](https://flask-restx.readthedocs.io/en/latest/)\n\n### Completion example\n\nPlease [click](./example/create_flask.py) to view the completed sample code.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A flask encapsulated based on personal habits for fast use.",
    "version": "0.2.0",
    "project_urls": {
        "Download": "https://github.com/FourCats-Py/FourCats-Flask/archive/0.2.0.tar.gz",
        "Homepage": "https://github.com/FourCats-Py/FourCats-Flask"
    },
    "split_keywords": [
        "fourcats",
        " flask"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "949d940ded34572d2e00b5ddef9c0c11196d33c3e71e8c25c2adaa98c61b9780",
                "md5": "ff5fab693be45a02ccf47654c130195b",
                "sha256": "5b3c4d199ff69fda4892982564846b6517a62fd74982bbe463cd88ce43dabbd1"
            },
            "downloads": -1,
            "filename": "fourcats_flask-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ff5fab693be45a02ccf47654c130195b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 18952,
            "upload_time": "2024-04-23T08:40:20",
            "upload_time_iso_8601": "2024-04-23T08:40:20.851975Z",
            "url": "https://files.pythonhosted.org/packages/94/9d/940ded34572d2e00b5ddef9c0c11196d33c3e71e8c25c2adaa98c61b9780/fourcats_flask-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "00aa8d7000a560c67fbfcd5ceb5d4fbdd1daf981f5dd9b028ef0ea0b0655c0c7",
                "md5": "eabfa15b150c41743de237bd14449ef6",
                "sha256": "923738adc2450fdf9a227846340fb0c607549f3479deb456fd5e6e5357af77c7"
            },
            "downloads": -1,
            "filename": "fourcats_flask-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "eabfa15b150c41743de237bd14449ef6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 15446,
            "upload_time": "2024-04-23T08:40:22",
            "upload_time_iso_8601": "2024-04-23T08:40:22.587223Z",
            "url": "https://files.pythonhosted.org/packages/00/aa/8d7000a560c67fbfcd5ceb5d4fbdd1daf981f5dd9b028ef0ea0b0655c0c7/fourcats_flask-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-23 08:40:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "FourCats-Py",
    "github_project": "FourCats-Flask",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "fourcats-flask"
}
        
Elapsed time: 0.35491s