Skip to main content

Building blocks for REST APIs for Flask

Project description

Building blocks for REST APIs for Flask.

Codecov

Usage

Create a SQLAlchemy model and a marshmallow schema, then:

from flask_resty import Api, GenericModelView

from .models import Widget
from .schemas import WidgetSchema


class WidgetViewBase(GenericModelView):
    model = Widget
    schema = WidgetSchema()


class WidgetListView(WidgetViewBase):
    def get(self):
        return self.list()

    def post(self):
        return self.create()


class WidgetView(WidgetViewBase):
    def get(self, id):
        return self.retrieve(id)

    def patch(self, id):
        return self.update(id, partial=True)

    def delete(self, id):
        return self.destroy(id)


api = Api(app, '/api')
api.add_resource('/widgets', WidgetListView, WidgetView)

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Flask-RESTy-0.15.2.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

Flask_RESTy-0.15.2-py2.py3-none-any.whl (25.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file Flask-RESTy-0.15.2.tar.gz.

File metadata

File hashes

Hashes for Flask-RESTy-0.15.2.tar.gz
Algorithm Hash digest
SHA256 8af5a277079995ba312c8a47b99c9316b4a2f99982a408c562eb5d9405e8dcbb
MD5 73e5f78dbbf423027a1075c132ce8105
BLAKE2b-256 5f422142d9569d2e18278a2c747af5c35a127fe4f3961a094c24561083b7a33c

See more details on using hashes here.

File details

Details for the file Flask_RESTy-0.15.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for Flask_RESTy-0.15.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f0238fa780040cee1ff45f5cfe77185f35b8365b7f046f5559407c59694f3bb6
MD5 90f6d17c933a406e871a50145bc5edca
BLAKE2b-256 484c7a58eb092d20ac87de2aa9ed999fb65a8bdef330e86c78722192e329b8a2

See more details on using hashes here.

Supported by

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