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.6.tar.gz
(16.1 kB
view details)
Built Distribution
File details
Details for the file flask-toolkits-0.0.6.tar.gz
.
File metadata
- Download URL: flask-toolkits-0.0.6.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 | 8a4d11ba684eaf2f98a1eb92511377368d45d94de440feed32279489521aa67d |
|
MD5 | 896e52b88ac43fb7aa9f5a6f0f84380b |
|
BLAKE2b-256 | 393afb86fc8a32ae3b3fa097edbdfaa98d78a322ff4d6776eaf547c44b4aa7e4 |
File details
Details for the file flask_toolkits-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: flask_toolkits-0.0.6-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 | 69a2b908b5af9489d14a3b0be94ac710bdbab554dbd88a1d675dfc2b0c2e2c27 |
|
MD5 | e096e9ef18b496948537e1be35d5c6d1 |
|
BLAKE2b-256 | 912c60c8b769a345c0305359f4e628f4376a44e7400e8ef6e2ce1f912ccb2f0f |