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
andresponse
) - 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 AutoSwagger
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
Project details
Release history Release notifications | RSS feed
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.7.tar.gz
(16.1 kB
view details)
Built Distribution
File details
Details for the file flask-toolkits-0.0.7.tar.gz
.
File metadata
- Download URL: flask-toolkits-0.0.7.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31c6b750af831100720f618e0086a8cd4bc9dc16dda0c7267ac2755372046e88 |
|
MD5 | c4a4b5f9fdb823f57d66771b4990fc80 |
|
BLAKE2b-256 | dc4a05bc4e90a687ef06a6a43e5433e1fdd5c5d22f5af6cb0cdc31e501bf9e31 |
File details
Details for the file flask_toolkits-0.0.7-py3-none-any.whl
.
File metadata
- Download URL: flask_toolkits-0.0.7-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f842640f900312debc7debd76c7873b740e751d67c7abebb4dc4c83f1ceedc2 |
|
MD5 | 40e44f72b5d1afd30e0e520289993ce3 |
|
BLAKE2b-256 | 56ea9cc34c16607e546d0a80f390bee5cd76fff8c07e2588ef19e0d10fd97bcd |