flask-api-factory-0.2.3
توضیحات
one small flask rest api factory
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | flask-api-factory-0.2.3 |
| نام | flask-api-factory |
| نسخه کتابخانه | 0.2.3 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Rodrigo Pinheiro Matias |
| ایمیل نویسنده | rodrigopmatias@gmail.com |
| آدرس صفحه اصلی | https://github.com/rodrigopmatias/flask-api-factory/blob/main/README.md |
| آدرس اینترنتی | https://pypi.org/project/flask-api-factory/ |
| مجوز | - |
The initial idea is to be a Rest API factory, with the aim of making it easy to create from models defined using the SQLAlchemy ORM.
We still use pydantic to serialize objects and payloads.
## Install
You can install using pip:
```shell
$ pip install flask-api-factory
```
You can install with the database driver you want to be supported by SQLAlchemy, but if you prefer, you can install the driver as an extra library, with the command:
```shell
$ pip install flask-api-factory[postgres]
```
This will install `psycopg2` together with our library.
You can still install using `poetry` with the command:
```shell
$ poetry add flask-api-factory
```
## A simple example
Having the `Pet` model already defined and the initialization of the `Flask` application already started, just use the following code:
```python
from flask import Flask, Blueprint
from flask_api_factory import factory_api
from .models import Pet
from .serializers import PetSerializer
blueprint = Blueprint("pets", __name__, url_prefix="/pets")
def init_app(app: Flask) -> None:
app.register_blueprint(blueprint)
factory_api(blueprint, Pet, PetSerializer)
```
This way we will have a `/pets` endpoint capable of responding to all HTTP verbs. Consulting the documentation you can check other options for configurations and functionalities.
## Roadmap
* [ ] Documentation;
* [X] `openapi.json` generation mechanism;
* [ ] A way to provide `Swagger` and/or `Redoc`;
* [ ] Write unit tests.
نیازمندی
| مقدار | نام |
|---|---|
| >=2.2.2,<3.0.0 | flask |
| >=20.1.0,<21.0.0 | gunicorn |
| >=3.0.3,<4.0.0 | flask-sqlalchemy |
| >=0.21.0,<0.22.0 | prometheus-flask-exporter |
| >=1.10.4,<2.0.0 | pydantic[dotenv] |
| >=4.0.4,<5.0.0 | flask-migrate |
| >=1.3.1,<2.0.0 | pika |
| >=0.0.3,<0.0.4 | mysql |
| >=2.9.5,<3.0.0 | psycopg2-binary |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.10,<4.0 | Python |
نحوه نصب
نصب پکیج whl flask-api-factory-0.2.3:
pip install flask-api-factory-0.2.3.whl
نصب پکیج tar.gz flask-api-factory-0.2.3:
pip install flask-api-factory-0.2.3.tar.gz