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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: flaskapi4-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 1310fb2588535faac84a8041030b59d8f0619e39e3d0fcbf2835691044051c4f
MD5 09d45f730d94d1b8478cfae6eb421be3
BLAKE2b-256 ba15d4ead2569490b81ea535caf34bdfeb9cc5ee4388c9c1a30d64fe9739c067

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flaskapi4-0.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b9967764af2c485f92b3bb8da033ce776931837e5015d5eb86b2367037ab8b86
MD5 92003597f11f9e64affbf15ade2d307b
BLAKE2b-256 15234610f9399b1ff9ff07373e43c5f1bb9c47202c323d98dcdcae907e87303d

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