Skip to main content

Building blocks for REST APIs for Flask

Project description

Building blocks for REST APIs for Flask.

Coveralls

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

Uploaded Source

Built Distribution

Flask_RESTy-0.10.2-py2.py3-none-any.whl (19.6 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for Flask-RESTy-0.10.2.tar.gz
Algorithm Hash digest
SHA256 8f9408af2c249aec0fb9ab12560d50b96ae56e98e46a6e21409d43c64ba340a7
MD5 a87d2ddce2deb5d99a3e0f0e25633e59
BLAKE2b-256 d42fa156e1095d2d0733b83ea342286d0f4a5b7614780330045249d24deb7c56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Flask_RESTy-0.10.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 18d7476ec048b5f368a21e5b2c424662a4c9da7f54e05b37e7d31d3b9e201d51
MD5 7d1fb7b12c970995b82b1c891d40d07a
BLAKE2b-256 015b3d00bd4a3139f286be9a2f5780a85c55d951b98061772ad22b7ec718f665

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