Flask extension for creating REST APIs. You get autogenerated OpenAPI spec (with Redoc and Swagger Docs), Request parsing and validations (query, path, body, form and files) and Response validation.
Project description
FlaskEase
Flask extension for creating REST APIs. You get autogenerated OpenAPI spec (with Redoc and Swagger Docs), Request parsing and validations (query, path, body, form and files) and Response validation.
Checkout example here
Documentation
Documentation is coming soon :)
Try Example
$ git clone git@github.com:zero-shubham/flask-ease.git
$ cd flask-ease
$ poetry install
$ source "$( poetry env list --full-path )/bin/activate"
$ python example/main.py
Now go to http://127.0.0.1:5000/docs to find SwaggerUI docs for your API.
Simple Usage
# * example/resources/pet.py
from application import (
my_api,
Depends,
HTTPException,
status
)
from schemas.pet import (
PetCreationForm,
PetInResp,
PetInDB
)
from utils.dependencies import get_current_user
from crud.pet import (
add_new_pet_to_db
)
from uuid import uuid4
@my_api.post(
route="/pets",
response_model=PetInResp,
tags=["pets"],
auth_required=True
)
def create_new_pet(
obj_in: PetCreationForm,
current_user=Depends(get_current_user)
):
"""
Add a new pet to DB
"""
if obj_in.owner != current_user["id"]:
raise HTTPException(
status.HTTP_403_FORBIDDEN,
"You are not authorised for this operation."
)
new_pet = add_new_pet_to_db(PetInDB(
id=uuid4(),
**obj_in.dict()
).dict())
return new_pet
For a complete understanding check the example here
File-uploads are not yet supported via FlaskEase - to be added soon
Now with File-upload and Multiform support.
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
Built Distribution
Hashes for FlaskEase-0.1.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d045e61f3ddec9be9832fc15d04a583ed4a1df6bcea54eac2d41525edff0fa7 |
|
MD5 | 8e6cdbe3b5635c6f49b25b8542383a28 |
|
BLAKE2b-256 | 1b08e74c00ae700fb4576cd79ef6e171ba4607c3939fc2f72f192cd23faf7e73 |