flaskapi4
Project description
Requirements
Python 3.9+
flaskapi4 is dependent on the following libraries:
Installation
pip install -U flaskapi4
A Simple Example
Here's a simple example, further go to the Example.
from pydantic import BaseModel
from flaskapi4 import Info, Tag
from flaskapi4 import Flaskapi
info = Info(title="book API", version="1.0.0")
app = Flaskapi(__name__, info=info)
book_tag = Tag(name="book", description="Some Book")
class BookQuery(BaseModel):
age: int
author: str
class ResultData(BaseModel):
code: int
message: str
data: dict
@app.get("/book", summary="get books", tags=[book_tag])
def get_book(query: BookQuery) -> ResultData:
"""
to get all books
"""
return {
"code": 0,
"message": "ok",
"data": [
{"bid": 1, "age": query.age, "author": query.author},
{"bid": 2, "age": query.age, "author": query.author}
]
}
if __name__ == "__main__":
app.run(debug=True)
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
flaskapi4-0.1.6.tar.gz
(1.2 MB
view details)
Built Distribution
File details
Details for the file flaskapi4-0.1.6.tar.gz
.
File metadata
- Download URL: flaskapi4-0.1.6.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.9.6 Darwin/24.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 195d64e56242ee157929250fb36ebcd136f34c5446e22900cb817d115a09d1cc |
|
MD5 | cff11e4d39684170841c0a43a997b012 |
|
BLAKE2b-256 | 7254c96aa59b3e5459da6a1e2048295725bd3350fb65bc2cba641404aac35621 |
File details
Details for the file flaskapi4-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: flaskapi4-0.1.6-py3-none-any.whl
- Upload date:
- Size: 1.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.9.6 Darwin/24.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8976d1c284f0ed4a28d06012b17d04c1e22d9073ce242690a022d0aa3c1e2889 |
|
MD5 | da3a2ecb2cfb77e74f7b3a9e5d534876 |
|
BLAKE2b-256 | 963516e456c32dc7aba191530c2e1334fe6fe3fdb9e3f81c446517067dc742e3 |