APIFlask
A lightweight Web API toolkit for Flask, based on marshmallow-code projects and other Flask extensions.
Currently this project is in plan/experimental stage, break changes are expected. Improvement and suggestions are welcome!
Installation
$ pip install apiflask
Example
from apiflask import APIFlask
from apiflask.decorators import arguments, body, response
from marshmallow import Schema
app = APIFlask(__name__)
class PetSchema(Schema):
id = Integer(dump_only=True)
name = String(required=True)
age = Integer(required=True)
category = String(required=True)
@app.route('/pets/<int:pet_id>')
@response(PetSchema)
def get_pet(pet_id):
pass
@app.route('/pets', methods=['POST'])
@body(PetSchema)
@response(PetSchema)
def create_pet(pet):
pass
@app.route('/pets', methods=['PUT'])
@body(PetSchema)
@response(PetSchema)
def update_pet(updated_pet, pet_id):
pass
Save the file as app.py, then run it with:
$ flask run
Now visit the interactive docs by Swagger UI at http://localhost:5000/docs:
Or you can visit the alternative Redoc docs at http://localhost:5000/redoc:
The auto-generated OpenAPI spec file are available at http://localhost:5000/openapi.json.
Links
- Documentation (WIP)
- PyPI
- Change Log
APIFlask starts as a fork of APIFairy 0.6.3dev and inspired by FastAPI.
Metadata
Release files for APIFlask 0.1.0
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 |
|---|---|---|---|---|
| APIFlask-0.1.0.tar.gz | 6.9 kB | Without provenance | Details for APIFlask-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| APIFlask-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for APIFlask-0.1.0-py3-none-any.whl |
Total release size: 16.6 kB
Release files / APIFlask-0.1.0.tar.gz
| Download URL | APIFlask-0.1.0.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a1fe0d01e62d0318e5a6e24c7483491b46ca85427765c203871e50a54719a241
|
|
BLAKE2b-256 checksum How to use checksums |
315637142588db3d153500f5a0d2a31ade8c5aa8f2fc47902555cc515c05f68d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.0
|
Release files / APIFlask-0.1.0-py3-none-any.whl
| Download URL | APIFlask-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fe253d77b8a35a25685f0e826ee435a60d0117df65201416aedc0ab6b34108f8
|
|
BLAKE2b-256 checksum How to use checksums |
c99203786496dc01f023005d52ec5dec416cc69f9333e89f3667fae7e3268842
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.0
|
Security for APIFlask 0.1.0
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.