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.8.tar.gz
(1.2 MB
view details)
Built Distribution
File details
Details for the file flaskapi4-0.1.8.tar.gz
.
File metadata
- Download URL: flaskapi4-0.1.8.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 | 2c4f301eb2400ed1c9c60470f3d0d59e4c87816c8bd2447e4240be7b9f1e14a4 |
|
MD5 | 4aaa0c68ec6d5c7ee6a298a44f8943c8 |
|
BLAKE2b-256 | 3c0de5ea916c16f20f4d7bfc141d48cc4bbbfc85cf32cfd715e07016623f8bd6 |
File details
Details for the file flaskapi4-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: flaskapi4-0.1.8-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 | 71c2d8bd2e33a9d4df2d6ce7517f82c71cee5e2c74294b3d7bc6533be29e3ef0 |
|
MD5 | bc468112d68b2b8975a4265a124f1bf3 |
|
BLAKE2b-256 | 3cc9237da90964da2c8c394f3568909f72e1bf3d0fdd95d780ff57c68f4fefa8 |