Generate RESTful API and OpenAPI document for your Flask project.
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.
Metadata
Release files for flask-openapi3-tarsa 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flask-openapi3_tarsa-1.0.2.tar.gz | 956.1 kB | Without provenance | Details for flask-openapi3_tarsa-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_openapi3_tarsa-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for flask_openapi3_tarsa-1.0.2-py3-none-any.whl |
Total release size: 1.9 MB
Release files / flask-openapi3_tarsa-1.0.2.tar.gz
| Download URL | flask-openapi3_tarsa-1.0.2.tar.gz |
|---|---|
| Size | 956.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f013106727a11e0e79200b0fc96b86306b2090fc108a34512f7cc9711302271
|
|
BLAKE2b-256 checksum How to use checksums |
d5926c41e5011a272745f39fa83816e04074bdef4b02d9278c679062074519d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / flask_openapi3_tarsa-1.0.2-py3-none-any.whl
| Download URL | flask_openapi3_tarsa-1.0.2-py3-none-any.whl |
|---|---|
| Size | 963.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fdb619aa79a67877f7e6bd70d7b44e574c3fc4f34465c74ac3bf4aedcc311f6e
|
|
BLAKE2b-256 checksum How to use checksums |
29f0638c46477dd6494b6672fe8712e0afd18e836b96a3754baf94b624d5926c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Security for flask-openapi3-tarsa 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.