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

Uploaded Source

Built Distribution

Flask_RESTy-0.10.9-py2.py3-none-any.whl (21.2 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for Flask-RESTy-0.10.9.tar.gz
Algorithm Hash digest
SHA256 748dd9692bf6fc4c46132298cc34be5a6e55d2e22a65d5a573bcaecbe073cfb8
MD5 5e1c55ee50176b138603c9e2bba6f84a
BLAKE2b-256 5aef819c6e0fa45b0bdd83c2906fb967b216559860116e1f0e06e737df09be0f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Flask_RESTy-0.10.9-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a79830f24d85f187dea50ee0ac40f787a8b01512f2f8f9512b56713ada7631a3
MD5 9ecf1bb5f99ca07a35c90787be5aecc5
BLAKE2b-256 6bba027ddc475be19b2e63159295f2f43afd7d067aee2ab7bbc7ef80dc1c4ab7

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