Skip to main content

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


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.7.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

flaskapi4-0.1.7-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file flaskapi4-0.1.7.tar.gz.

File metadata

  • Download URL: flaskapi4-0.1.7.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

Hashes for flaskapi4-0.1.7.tar.gz
Algorithm Hash digest
SHA256 da69a53ca4ecf701cc4922b35b6336194c250f4c51a7e55bcb1f10383334af20
MD5 bb5b320a64fcc716514feb498c6a88c4
BLAKE2b-256 4e535d9929a9a13afe14d56013fc73487f52374f5c136b9a546d62c858364825

See more details on using hashes here.

File details

Details for the file flaskapi4-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: flaskapi4-0.1.7-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

Hashes for flaskapi4-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5256b64076d19bf2898f63a6841679c9aaf498d1a8a52ac3860730b1b0549071
MD5 08d6b9b51f68bd86b59941c667e56b93
BLAKE2b-256 565afb4dd5498d6e78df18fd225ec481d486638bbda5542c3c4cbf65fad1a569

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page