Skip to main content

A flask encapsulated based on personal habits for fast use.

Project description

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

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

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

Completion example

Please click to view the completed sample code.

Project details


Download files

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

Source Distribution

fourcats_flask-0.2.1.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

fourcats_flask-0.2.1-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file fourcats_flask-0.2.1.tar.gz.

File metadata

  • Download URL: fourcats_flask-0.2.1.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for fourcats_flask-0.2.1.tar.gz
Algorithm Hash digest
SHA256 343629af65059ed1dd6bf4ba892d657b99ab9d480b7202504d2bf68e3e5726dc
MD5 55ba99689efdfd4069821627a2f66fc0
BLAKE2b-256 5e06529cbc8d4789f347e18884833b345712815b53cb83068ee3d3ab424d77ca

See more details on using hashes here.

File details

Details for the file fourcats_flask-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fourcats_flask-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f8cb0f5a57ceccae297708a19a4714ab652d43ceedbbd84e2c33da337b074a4c
MD5 c5243c15dac2f6e0f26bb64e40a9a84e
BLAKE2b-256 f9306e1a654dace5611b84bd227d988a85bab4c42a236f6b2c6381b7e6738208

See more details on using hashes here.

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