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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: flaskapi4-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 0876bea8144d92ba8d9e05f5953b19d8185e3fb87725feafc3a46b9efcd4a6a5
MD5 7772cc2fa9203f12882c703137916dd2
BLAKE2b-256 b08757f9e71b104e0fdc23da3f2d2df1078bf801ddabdb7ea3a1a1f64056f7f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flaskapi4-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 87938d309cb1415796ca133bd5e8f6002b31b484e9c105c8b72229a0526e96ac
MD5 1051dab5636038def7e259d1035d81b8
BLAKE2b-256 ecaa122a891da988d96846af0520c1b04f61301b91b09267514c636f1659897f

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