Skip to main content

Flask toolkits to boost your development and simplify flask, its featured with AutoSwagger

Project description

Flask Toolkits

Repository

Installation

pip install flask-toolkits

Description

Flask toolkits implements and provides several features from FastAPI like:

  • automatic API documentation using AutoSwagger (define the function and we'll generate the openapi spec for you)
  • Base HTTP Middleware (middleware with direct access to request and response)
  • pydantic's validator
  • Response functions that could return any type of data without worried to get error
  • much more..

Changelogs

  • v0.0
    • First Upload

AUTO SWAGGER DOCUMENTATION

define your router using APIRouter class, lets put it in another pyfile

email_view.py

from typing import Optional
from flask_toolkits import APIRouter, Body, Header, Query
from flask_toolkits.responses import JSONResponse


router = APIRouter("email", import_name=__name__, static_folder="/routers/email", url_prefix="/email")


@router.post("/read", tags=["Email Router])
def get_email(
    id: int = Body(...),
    name: Optional[str] = Body(...),
    token: int = Header(...),
    race: Optional[str] = Query(None)
):
    return JSONResponse({"id":id, "name": name})

main.py

from flask import Flask
from flask_toolkits import APIRouter, AutoSwagger
from flask_toolkits.responses import JSONResponse, PlainTextResponse
from flask_toolkits.swagger import PathTemplate

from email_view import router as email_router


app = Flask(__name__)

auto_swagger = AutoSwagger()

app.register_blueprint(email_router)
app.register_blueprint(auto_swagger)


if __name__ == "__main__":
    app.run()

then you can go to http://localhost:5000/docs and you will found you router is already documented

[alt]

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

flask-toolkits-0.0.4.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

flask_toolkits-0.0.4-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file flask-toolkits-0.0.4.tar.gz.

File metadata

  • Download URL: flask-toolkits-0.0.4.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for flask-toolkits-0.0.4.tar.gz
Algorithm Hash digest
SHA256 e8deb091627bbabfab7e131a11cca606443d70189fdea502309ef3dc9e0c690e
MD5 63d5b2fdbddb7c762ac1d20af835260e
BLAKE2b-256 8bdff6a02fa88d8634accf64069ce3ec252d56cec7479e971f3778bf5d2be875

See more details on using hashes here.

File details

Details for the file flask_toolkits-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: flask_toolkits-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for flask_toolkits-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 60f14fea664cdb3df7b91a513fb0051e3e95e73ae0aa07dbd53b67e8d3671721
MD5 d10f5c88a319989ed9efdbc52dc82d35
BLAKE2b-256 af6837befc3743c28a4adfbe70db5c206262bec6401a16de47610d1e1f8facef

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