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)
Metadata
Release files for flaskapi4 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flaskapi4-0.1.8.tar.gz | 1.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flaskapi4-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.5 MB
Release files / flaskapi4-0.1.8.tar.gz
| Download URL | flaskapi4-0.1.8.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c4f301eb2400ed1c9c60470f3d0d59e4c87816c8bd2447e4240be7b9f1e14a4
|
|
BLAKE2b-256 checksum How to use checksums |
3c0de5ea916c16f20f4d7bfc141d48cc4bbbfc85cf32cfd715e07016623f8bd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.9.6 Darwin/24.0.0
|
Release files / flaskapi4-0.1.8-py3-none-any.whl
| Download URL | flaskapi4-0.1.8-py3-none-any.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
71c2d8bd2e33a9d4df2d6ce7517f82c71cee5e2c74294b3d7bc6533be29e3ef0
|
|
BLAKE2b-256 checksum How to use checksums |
3cc9237da90964da2c8c394f3568909f72e1bf3d0fdd95d780ff57c68f4fefa8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.9.6 Darwin/24.0.0
|