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.10.6.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

Flask_RESTy-0.10.6-py2.py3-none-any.whl (21.1 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for Flask-RESTy-0.10.6.tar.gz
Algorithm Hash digest
SHA256 023170f5bbf66c00f4001f076dda97fd3e8b747eb5493a8c01f2bab8cd6f2355
MD5 8c58db1348c00d2872828affa8e88803
BLAKE2b-256 4b3a1ba83167e38465e8b2ad2bbddb99b929676e56ca2ac71bd67a0be9606ee3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Flask_RESTy-0.10.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ef07747c30176dcec2c793bcb9cef13a0176fbd476d3176e94c8ec573e5c61c7
MD5 b336a651ef5ab00c6166025a22e70902
BLAKE2b-256 3e60be6330d957c92eb67ae115b7f9de5467af10d932db5be56161c32cdbd396

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