Skip to main content

Generate RESTful API and OpenAPI document for your Flask project.

Project description

Generate RESTful API and OpenAPI document for your Flask project.

test pypi pypistats pypi versions

Requirements

Python 3.7+

flask-openapi3 be dependent on the following libraries:

Installation

pip install -U flask-openapi3

A Simple Example

Here's a simple example, further go to the Example.

from pydantic import BaseModel

from flask_openapi3 import Info, Tag
from flask_openapi3 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


@app.get('/book', tags=[book_tag])
def get_book(query: BookQuery):
    """get books
    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)

API Document

Run the simple example, and go to http://127.0.0.1:5000/openapi.

You will see the document: Swagger UI , Redoc and RapiDoc.

openapi openapi-swagger openapi-redoc openapi-RapiDoc

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

flask-openapi3_tarsa-1.0.2.tar.gz (956.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_openapi3_tarsa-1.0.2-py3-none-any.whl (963.5 kB view details)

Uploaded Python 3

File details

Details for the file flask-openapi3_tarsa-1.0.2.tar.gz.

File metadata

  • Download URL: flask-openapi3_tarsa-1.0.2.tar.gz
  • Upload date:
  • Size: 956.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.5 tqdm/4.62.3 importlib-metadata/4.0.1 keyring/23.0.1 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for flask-openapi3_tarsa-1.0.2.tar.gz
Algorithm Hash digest
SHA256 9f013106727a11e0e79200b0fc96b86306b2090fc108a34512f7cc9711302271
MD5 9afec7f20449541951ec6945eaeb882c
BLAKE2b-256 d5926c41e5011a272745f39fa83816e04074bdef4b02d9278c679062074519d6

See more details on using hashes here.

File details

Details for the file flask_openapi3_tarsa-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: flask_openapi3_tarsa-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 963.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.5 tqdm/4.62.3 importlib-metadata/4.0.1 keyring/23.0.1 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for flask_openapi3_tarsa-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fdb619aa79a67877f7e6bd70d7b44e574c3fc4f34465c74ac3bf4aedcc311f6e
MD5 f70f5520ee9b6959197936e06b0cec52
BLAKE2b-256 29f0638c46477dd6494b6672fe8712e0afd18e836b96a3754baf94b624d5926c

See more details on using hashes here.

Supported by

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