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.1.tar.gz (956.0 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.1-py3-none-any.whl (963.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flask-openapi3_tarsa-1.0.1.tar.gz
  • Upload date:
  • Size: 956.0 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.1.tar.gz
Algorithm Hash digest
SHA256 9a94d0acd1cae16ae27ba60cfda489921044d2bdb59658134f70962950bed20f
MD5 53b87a5d4ee0a6cc6fa11874ed248999
BLAKE2b-256 893df0cdf7f3a03d7adaa488b75a5c53674f9b1711205f235f196c78c6150ff3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flask_openapi3_tarsa-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 963.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d546fd846d889e799630b0ed193328df9d43dc7d414891ec52cabe40d797279a
MD5 9a0a391a167af90625115e5ed46cb177
BLAKE2b-256 00c44b3103c3548e685a4f4773cbebff9e5503e48cdf7ad24d37b47e1780a405

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