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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: flaskapi4-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 765f138b1c28b24da2b36fb0ae500e86da48b176dd5d109c2aa2b5060bf51c5e
MD5 dab33805ff1a2e29eec98131a5939df3
BLAKE2b-256 39d59619ab538a4211a1052d8283ffb3aff3e59d4609505ea84c423ac83e6d8a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flaskapi4-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dd6031790bcf9a8dbbc349d23dce5ecff697ef49322d68cdd423c941e13732ba
MD5 2f6a24b96e74eb13d46cad9e599ea629
BLAKE2b-256 8998160880d99b9c97b1c3b214b234f5a86d08a8ba962de0bddfa9dcb3a820c5

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