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 OpenAPI

info = Info(title="book API", version="1.0.0")
app = OpenAPI(__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.4.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: flaskapi4-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 19f8dbc50297de3c88df57618ca9c459e6b3da263a2823e0d0edd80b52732834
MD5 ee64cac03dcaf46d0ca265d0c0b5d292
BLAKE2b-256 60d5c71ca145e3209061fe9473058fd6ebebe24d5036ee2b262bb30aaf1dacc1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flaskapi4-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c9afbc1ed95318f7986da1ef4319e5fd3cf4ffda66b1e4ea408c4231fb2da11d
MD5 63209f8d2d47e1d4285ab16488e862ea
BLAKE2b-256 0d53d911cc4f8ec6a3fa6b1b18df6d2235913c7bba054ae1177de549f5564a3c

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